using HKB.Common;
using HKB.Data;
using HKB.Data.Dal;
using HKB.Data.Dal.S_ProductTableAdapters;
using System;
using System.Collections;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.Web;
using System.Web.UI;
namespace HKB.Web
{
	public class Shop_Product
	{
		private static Shop_Product _instance = null;
		private Conn conn = null;
		private Pagination _pageHand = null;
		private static readonly HLShop_ProductTableAdapter Adapter = new HLShop_ProductTableAdapter();
		public static Shop_Product instance
		{
			get
			{
				if (Shop_Product._instance == null)
				{
					Shop_Product._instance = new Shop_Product(new Conn());
				}
				return Shop_Product._instance;
			}
		}
		public Pagination pageHand
		{
			get
			{
				Pagination pageHand;
				if (this._pageHand == null)
				{
					this._pageHand = new Pagination();
					this._pageHand.SQL_CloseTablePre = false;
					this._pageHand.SQL_Fields = "*,(Select ClassName From [HLShop_Class] Where ClassID=HLShop_Product.ClassID) as ClassName";
					this._pageHand.P_Object = Language.GetAdminMsg("Product/ProductName");
					pageHand = this._pageHand;
				}
				else
				{
					pageHand = this._pageHand;
				}
				return pageHand;
			}
		}
		public Shop_Product(Conn _conn)
		{
			this.conn = _conn;
		}
		public Shop_Product()
		{
			this.conn = Text.GetComponent<Conn>("conn", HttpContext.Current.CurrentHandler);
		}
		public DataTable GetAllProduct(int pageindex, int maxperpage, string WhereStr, string OrderBystr)
		{
			return this.pageHand.GetDataTable("HLShop_Product", pageindex, maxperpage, "ProductID", WhereStr, OrderBystr, this.conn, null);
		}
		public DataTable GetAllProduct(int pageindex, int maxperpage, string WhereStr, string OrderBystr, params IDbDataParameter[] param)
		{
			return this.pageHand.GetDataTable("HLShop_Product", pageindex, maxperpage, "ProductID", WhereStr, OrderBystr, this.conn, param);
		}
		public string GetPagePanel(string linkHead)
		{
			this.pageHand.P_LinkHead = linkHead;
			return this.pageHand.ShowPagePanel();
		}
		public decimal GetTaxRate(int ProductID)
		{
			decimal result = 0m;
			object scalar = this.conn.GetScalar("Select [TaxRate] From [HLShop_Product] Where ProductID=" + ProductID, new IDbDataParameter[0]);
			if (scalar != DBNull.Value && scalar != null)
			{
				result = (decimal)scalar;
			}
			return result;
		}
		public DataTable GetProudctBySalerIDProductNameProductType(int SalerID, string ProductName, int ProductType)
		{
			SqlParameter[] array = new SqlParameter[3];
			array[0] = new SqlParameter("@SalerID", SqlDbType.Int);
			array[0].Value = SalerID;
			array[1] = new SqlParameter("@ProductName", SqlDbType.NVarChar);
			array[1].Value = ProductName;
			array[2] = new SqlParameter("@ProductType", SqlDbType.Int);
			array[2].Value = ProductType;
			return this.conn.GetDataTable("Pr_GetProductBySalerIDNameType", array);
		}
		public int GetProductByUploadPic(string filepath)
		{
			return 0;
		}
		public void UpdateHits(int ProductID)
		{
			this.conn.Execute("Update [HLShop_Product] Set Hits=Hits+1 Where ProductID=" + ProductID);
		}
		public int CountUserProductNum(int userid)
		{
			return this.conn.ExecuteCount("Select count(*) from [HLShop_Product] Where SalerID=" + userid);
		}
		public DataTable GetProductByProductID(int ProductID)
		{
			return this.conn.GetDataTable("SELECT DATEDIFF(s, GETDATE(), HLShop_Product.EndDate) AS LeftTime,HLShop_Product.*, HL_User.UserName AS salername FROM HLShop_Product INNER JOIN  HL_User ON HLShop_Product.SalerID = HL_User.UserID  WHERE (HLShop_Product.ProductID = " + ProductID + ")");
		}
		public DataTable GetProductByProductName(string ProductName)
		{
			IDbDataParameter dbDataParameter = this.conn.CreateParameter("@ProductName", DbType.String, ProductName);
			return this.conn.GetDataTable("Select * From [HLShop_Product] Where ([ProductName]=@ProductName)", new IDbDataParameter[]
			{
				dbDataParameter
			});
		}
		public DataTable GetAuctionProduct(int UserID, int type, string WhereStr, params IDbDataParameter[] param)
		{
			if (WhereStr != "")
			{
				WhereStr += " and ";
			}
			else
			{
				WhereStr = " Where ";
			}
			string text = string.Concat(new object[]
			{
				"Select [HLShop_Product].*,(select UserName from  [HL_User] where UserID=[HLShop_Product].SalerID) as UserName From [HLShop_Product] ",
				WhereStr,
				" ProductID in(Select distinct(I.ProductID) From HLShop_OrderItem I Inner Join HLShop_Order O On O.OrderFormID=I.OrderFormID Where O.TradeType=2 and O.UserID=",
				UserID
			});
			if (type == 0)
			{
				text += " and DateDiff(s,O.UpdateTime,getdate())<0 ";
			}
			else
			{
				if (type == 1)
				{
					text += " and DateDiff(s,O.UpdateTime,getdate())>=0 ";
				}
			}
			text += ") Order By ProductID Desc";
			DataTable dataTable;
			if (param == null)
			{
				dataTable = this.conn.GetDataTable(text);
			}
			else
			{
				dataTable = this.conn.GetDataTable(text, param);
			}
			return dataTable;
		}
		public DataTable GetSalerAuctionProduct(int SalerID, int type, string WhereStr, params IDbDataParameter[] param)
		{
			string text = string.Concat(new object[]
			{
				"Select * From [HLShop_Product] ",
				WhereStr,
				" ProductID in(Select distinct(I.ProductID) From HLShop_OrderItem I Inner Join HLShop_Order O On I.OrderFormID=O.OrderFormID Inner Join HLShop_Product P On I.ProductID=P.ProductID  Where O.TradeType=2 and O.SalerID=",
				SalerID
			});
			if (type == 0)
			{
				text = "Select * From [HLShop_Product] WHERE DateDiff(s, EndDate, getdate())<0 AND ProductType =2 AND SalerID =" + SalerID;
			}
			else
			{
				if (type == 1)
				{
					text = "Select * From [HLShop_Product] WHERE DateDiff(s, EndDate, getdate())>=0 AND ProductType =2 AND SalerID =" + SalerID;
				}
				else
				{
					text = "Select * From [HLShop_Product] WHERE ProductType =2 AND SalerID =" + SalerID;
				}
			}
			text += " Order By ProductID Desc";
			DataTable dataTable;
			if (param == null)
			{
				dataTable = this.conn.GetDataTable(text);
			}
			else
			{
				dataTable = this.conn.GetDataTable(text, param);
			}
			return dataTable;
		}
		public DataTable GetBuyerTeamBuyProduct(int UserID, int type, string WhereStr, params IDbDataParameter[] param)
		{
			if (WhereStr != "")
			{
				WhereStr += " and ";
			}
			else
			{
				WhereStr = " Where ";
			}
			DateTime now = DateTime.Now;
			string text = string.Empty;
			if (type == 0)
			{
				text = " and Teameffect<>1 ";
			}
			else
			{
				if (type == 1)
				{
					text = " and Teameffect=1 ";
				}
			}
			string text2 = string.Concat(new object[]
			{
				"Select * From [HLShop_Product] ",
				WhereStr,
				" ProductID in (Select distinct(I.ProductID) From HLShop_OrderItem I Inner Join HLShop_Order O On I.OrderFormID=O.OrderFormID Where O.TradeType=3 ",
				text,
				" and O.UserID=",
				UserID,
				")"
			});
			text2 += "  Order By ProductID Desc";
			DataTable dataTable = null;
			if (param == null)
			{
				dataTable = this.conn.GetDataTable(text2);
			}
			else
			{
				dataTable = this.conn.GetDataTable(text2, param);
			}
			if (dataTable != null)
			{
				if (dataTable.Rows.Count > 0)
				{
					StringBuilder stringBuilder = new StringBuilder();
					dataTable.Columns.Add("Status");
					dataTable.Columns.Add("OrderFormNum");
					dataTable.Columns.Add("Quantity");
					dataTable.Columns.Add("MoneyReceipt");
					dataTable.Columns.Add("Teameffect");
					dataTable.Columns.Add("OrderFormID");
					foreach (DataRow dataRow in dataTable.Rows)
					{
						string sql = string.Format("Select Status,O.OrderFormNum,I.Quantity,O.MoneyReceipt,O.Teameffect,O.OrderFormID From HLShop_OrderItem I Inner Join HLShop_Order O On I.OrderFormID=O.OrderFormID Where O.TradeType=3 and O.UserID={0} AND ProductID={1} ORDER BY ProductID Desc", UserID, dataRow["ProductID"].ToString());
						DataTable dataTable2 = this.conn.GetDataTable(sql);
						if (dataTable2 != null)
						{
							if (dataTable2.Rows.Count > 0)
							{
								DataRow dataRow2 = dataTable2.Rows[0];
								dataRow["Status"] = dataRow2[0];
								dataRow["OrderFormNum"] = dataRow2[1];
								dataRow["Quantity"] = dataRow2[2];
								dataRow["MoneyReceipt"] = dataRow2[3];
								dataRow["Teameffect"] = dataRow2[4];
								dataRow["OrderFormID"] = dataRow2[5];
							}
							dataTable2.Dispose();
						}
					}
				}
			}
			return dataTable;
		}
		public DataTable GetSalerTeamBuyProduct(int SalerID, int type, string Fields, string WhereStr, params IDbDataParameter[] param)
		{
			string text = "";
			if (WhereStr != "")
			{
				WhereStr += " and ";
			}
			else
			{
				WhereStr = " Where ";
			}
			if (string.IsNullOrEmpty(Fields))
			{
				Fields = "*";
			}
			if (type == 0)
			{
				text = " and O.Teameffect<>1 ";
			}
			else
			{
				if (type == 1)
				{
					text = " and O.Teameffect=1 ";
				}
			}
			string text2 = string.Concat(new object[]
			{
				"Select ",
				Fields,
				" From [HLShop_Product] ",
				WhereStr,
				" ProductID in(Select distinct(I.ProductID) From HLShop_OrderItem I Inner Join HLShop_Order O On O.OrderFormID=I.OrderFormID Where O.TradeType=3 ",
				text,
				" and O.SalerID=",
				SalerID,
				") "
			});
			text2 += "  Order By ProductID Desc";
			DataTable dataTable;
			if (param == null)
			{
				dataTable = this.conn.GetDataTable(text2);
			}
			else
			{
				dataTable = this.conn.GetDataTable(text2, param);
			}
			return dataTable;
		}
		public DataTable GetSalerProductByType(int SalerID, int Type)
		{
			return this.conn.GetDataTable(string.Concat(new object[]
			{
				"Select * From [HLShop_Product] Where SalerID=",
				SalerID,
				" and ProductType=",
				Type
			}));
		}
		public DataTable GetPrepaidOrder(int UserID)
		{
			return this.conn.GetDataTable("select * from HLShop_Order as a,HLShop_OrderItem as b where a.OrderFormID=b.OrderFormID and a.TradeType=3 and a.UserID=" + UserID);
		}
		public DataTable GetInStockBySalerID(int SalerID, string wherestr, string orderstr, params IDbDataParameter[] param)
		{
			if (wherestr != "")
			{
				wherestr += " and ";
			}
			else
			{
				wherestr += " where ";
			}
			DataTable dataTable;
			if (param == null)
			{
				dataTable = this.conn.GetDataTable(string.Concat(new object[]
				{
					"Select * From [HLShop_Product] ",
					wherestr,
					"  SalerID=",
					SalerID,
					" and (Stocks<0 Or EnableSale=0 OR DateDiff(s,EndDate,'",
					DateTime.Now,
					"')>0) ",
					orderstr
				}));
			}
			else
			{
				dataTable = this.conn.GetDataTable(string.Concat(new object[]
				{
					"Select * From [HLShop_Product] ",
					wherestr,
					"  SalerID=",
					SalerID,
					" and (Stocks<0 Or EnableSale=0 OR DateDiff(s,EndDate,'",
					DateTime.Now,
					"')>0) ",
					orderstr
				}), param);
			}
			return dataTable;
		}
		public int Justcarriage(int ProductID)
		{
			int num = this.conn.ExecuteCount(string.Concat(new object[]
			{
				"select count(*) from HLShop_Product where (Stocks<=0 Or EnableSale=0 OR DateDiff(s,EndDate,'",
				DateTime.Now,
				"')>0) and ProductID=",
				ProductID
			}));
			int num2 = this.conn.ExecuteCount(string.Concat(new object[]
			{
				"select count(*) from HLShop_Product where DateDiff(s,BeginDate,'",
				DateTime.Now,
				"')<=0 and ProductID=",
				ProductID
			}));
			int result;
			if (num > 0)
			{
				result = 1;
			}
			else
			{
				if (num2 > 0)
				{
					result = 2;
				}
				else
				{
					result = 0;
				}
			}
			return result;
		}
		public int CheckProductNum(int ProductID)
		{
			int num = this.conn.ExecuteCount(string.Concat(new object[]
			{
				"select count(*) from HLShop_Product where (Stocks<=0 and DateDiff(s,EndDate,'",
				DateTime.Now,
				"')<0) and ProductID=",
				ProductID
			}));
			int result;
			if (num > 0)
			{
				result = 1;
			}
			else
			{
				result = 0;
			}
			return result;
		}
		public DataTable GetOnSaleProductBySalerID(int SalerID)
		{
			return Shop_Product.Adapter.GetOnSaleProductBySalerID(new int?(SalerID));
		}
		public DataTable GetProductsByProudctType(int ProductType)
		{
			IDbDataParameter dbDataParameter = this.conn.CreateParameter("@ProductType", DbType.Int32, ProductType);
			return this.conn.GetDataTable("Select * From [HLShop_Product] Where ([ProductType]=@ProductType)", new IDbDataParameter[]
			{
				dbDataParameter
			});
		}
		public DataTable GetProductsByProductPlace(string ProductPlace)
		{
			IDbDataParameter dbDataParameter = this.conn.CreateParameter("@ProductPlace", DbType.String, ProductPlace);
			return this.conn.GetDataTable("Select * From [HLShop_Product] Where ([ProductPlace] like '%'+ @ProductPlace +'%')", new IDbDataParameter[]
			{
				dbDataParameter
			});
		}
		public DataTable GetRecommendProductBySalerID(int SalerID)
		{
			IDbDataParameter dbDataParameter = this.conn.CreateParameter("@SalerID", DbType.String, SalerID);
			return this.conn.GetDataTable(string.Concat(new object[]
			{
				"Select * From [HLShop_Product] Where DateDiff(s,'",
				DateTime.Now,
				"',BeginDate)<=0 and DateDiff(s,'",
				DateTime.Now,
				"',EndDate)>0 and IsElite=1 and EnableSingleSell=1 and EnableSale=1 and ([SalerID]=@SalerID)"
			}), new IDbDataParameter[]
			{
				dbDataParameter
			});
		}
		public DataTable GetRecommendProductBySalerID(int SalerID, string proWhere)
		{
			IDbDataParameter dbDataParameter = this.conn.CreateParameter("@SalerID", DbType.String, SalerID);
			return this.conn.GetDataTable(string.Concat(new object[]
			{
				"Select * From [HLShop_Product] Where DateDiff(s,'",
				DateTime.Now,
				"',BeginDate)<=0 and DateDiff(s,'",
				DateTime.Now,
				"',EndDate)>0 and IsElite=1 and EnableSingleSell=1 and EnableSale=1 and ([SalerID]=@SalerID)",
				proWhere
			}), new IDbDataParameter[]
			{
				dbDataParameter
			});
		}
		public DataTable GetRecommendProductBySalerID(int SalerID, int num)
		{
			IDbDataParameter dbDataParameter = this.conn.CreateParameter("@SalerID", DbType.String, SalerID);
			return this.conn.GetDataTable(string.Concat(new object[]
			{
				"Select top ",
				num,
				" * From [HLShop_Product] Where DateDiff(s,'",
				DateTime.Now,
				"',BeginDate)<=0 and DateDiff(s,'",
				DateTime.Now,
				"',EndDate)>0 and IsElite=1 and EnableSingleSell=1 and EnableSale=1 and ([SalerID]=@SalerID)"
			}), new IDbDataParameter[]
			{
				dbDataParameter
			});
		}
		public DataTable GetOnSaleProductByShopID(int ShopID, int indexpage, int maxperpage, string WhereStr, string OrderByStr, params IDbDataParameter[] param)
		{
			if (WhereStr != string.Empty)
			{
				WhereStr = WhereStr + " and EnableSale=1 and DateDiff(s,BeginDate,getdate())>=0 and DateDiff(s,getdate(),EndDate)>0 and Stocks>0 and ShopID=" + ShopID;
			}
			else
			{
				WhereStr = WhereStr + " Where EnableSale=1 and DateDiff(s,BeginDate,getdate())>=0 and DateDiff(s,getdate(),EndDate)>0 and Stocks>0 and ShopID=" + ShopID;
			}
			this._pageHand = null;
			this.pageHand.SQL_Fields = "*,case when ProductType =1  then StandPrice  when (ProductType=3 and TeamNum=1)  then TeamPrice1 when(ProductType=3 and TeamNum=2) then TeamPrice2 when(ProductType=3 and TeamNum=3) then TeamPrice3 when(ProductType=3 and TeamNum=4) then TeamPrice4 when(ProductType=3 and TeamNum=5) then TeamPrice5 when ProductType =4  then StandPrice else AuctionStartPrice end as Price,DateDiff(ss,getdate(),EndDate) as LeftTime";
			return this.pageHand.GetDataTable("HLShop_Product", indexpage, maxperpage, "ProductID", WhereStr, OrderByStr, this.conn, param);
		}
		public DataTable GetOnSaleProductByShopID(int ShopID, int indexpage, int maxperpage, string WhereStr, string OrderByStr)
		{
			if (WhereStr != string.Empty)
			{
				WhereStr = WhereStr + " and EnableSale=1 and DateDiff(s,BeginDate,getdate())>=0 and DateDiff(s,getdate(),EndDate)>0 and Stocks>0 and ShopID=" + ShopID;
			}
			else
			{
				WhereStr = WhereStr + " Where EnableSale=1 and DateDiff(s,BeginDate,getdate())>=0 and DateDiff(s,getdate(),EndDate)>0 and Stocks>0 and ShopID=" + ShopID;
			}
			this._pageHand = null;
			this.pageHand.SQL_Fields = "*,(case when ProductType =1  then StandPrice  when (ProductType=3 and TeamNum=1)  then TeamPrice1 when(ProductType=3 and TeamNum=2) then TeamPrice2  when(ProductType=3 and TeamNum=3) then TeamPrice3 when(ProductType=3 and TeamNum=4) then TeamPrice4 when(ProductType=3 and TeamNum=5) then TeamPrice5 when ProductType =4  then StandPrice else AuctionStartPrice end) as Price,DateDiff(s,getdate(),EndDate) as LeftTime";
			return this.pageHand.GetDataTable("HLShop_Product", indexpage, maxperpage, "ProductID", WhereStr, OrderByStr, this.conn, null);
		}
		public int EditSaleProductProtity(string ProductID_Array, string Type)
		{
			int result;
			if (Type != "")
			{
				SqlParameter[] array = new SqlParameter[2];
				array[0] = new SqlParameter("@ProductID", DbType.String);
				array[0].Value = ProductID_Array;
				array[1] = new SqlParameter("@Type", DbType.String);
				array[1].Value = Type;
				result = this.conn.Execute("pr_EditProductByProductID", array);
			}
			else
			{
				result = 0;
			}
			return result;
		}
		public DataTable GetCompareProductsByPrdouctID_Array(string ProductID_Array)
		{
			SqlParameter sqlParameter = this.conn.CreateParameter("@ProductID_Array", SqlDbType.NVarChar, ProductID_Array);
			return this.conn.GetDataTable("pr_GetProductsForCompare", new SqlParameter[]
			{
				sqlParameter
			});
		}
		public DataTable GetInStockProductsBySalerID(int SalerID, string Type)
		{
			return Shop_Product.Adapter.GetProductInStock(new int?(SalerID), Type.ToLower());
		}
		public DataTable AddProduct(int ShopID, int SalerID, int ChannelID, string ProductPlace, string ProductNum, int ClassID, string ProductName, string ProductModel, string ProductStandard, string ProducerName, string TrademarkName, string ProductIntro, string ProductImageUrl, string ProductType, decimal StandPrice, decimal AuctionStartPrice, decimal ImcrementPrice, decimal MemberPrice, decimal CurrentPrice, string TeamName, int TeamNum, decimal TeamPrice1, decimal TempSubScriptionRate, int TeamNumber1, decimal TeamPrice2, int TeamNumber2, decimal TeamPrice3, int TeamNumber3, decimal TeamPrice4, int TeamNumber4, decimal TeamPrice5, int TeamNumber5, bool IsElite, int Stocks, bool EnableSale, string Keyword, string Inputer, int SalePromotionType, int Weight, string Propority, string DeliverType, string DeliverCharge, bool NeedInvoice, bool Guarantee, int ValidDay, bool AutoPostBack, string Remark, int DeliverPayType, string OnlinePayType, string PayType, int Hits, int BuyTimes, bool OnTop, bool IsHot, int Stars, DateTime BeginDate, DateTime EndDate, int LimitNum, bool EnableSingleSell, int TemplateID, int SkinID, int Discount, int PresentExp, int PresentPoint, decimal PresentMoney, int Discount1, int PresentExp1, int PresentPoint1, decimal PresentMoney1, int Discount2, int PresentExp2, int PresentPoint2, decimal PresentMoney2, int Discount3, int PresentExp3, int PresentPoint3, decimal PresentMoney3, string PUnit, string SetBeginDate, string ProductSmallImageUrl, decimal TaxRate, string UploadFiles, string Province, string City, string Color, string Size, string Attributes, decimal PartPrice, string StrColor, string StrSize, string CustomPrice, bool IntegraUse)
		{
			SqlParameter[] array = new SqlParameter[91];
			array[0] = new SqlParameter("@ShopID", DbType.Int32);
			array[0].Value = ShopID;
			array[1] = new SqlParameter("@SalerID", DbType.Int32);
			array[1].Value = SalerID;
			array[2] = new SqlParameter("@ChannelID", DbType.Int32);
			array[2].Value = ChannelID;
			array[3] = new SqlParameter("@ProductPlace", DbType.String);
			array[3].Value = ProductPlace;
			array[4] = new SqlParameter("@ProductNum", DbType.String);
			array[4].Value = ProductNum;
			array[5] = new SqlParameter("@ClassID", DbType.Int32);
			array[5].Value = ClassID;
			array[6] = new SqlParameter("@ProductName", DbType.String);
			array[6].Value = ProductName;
			array[7] = new SqlParameter("@ProductModel", DbType.String);
			array[7].Value = ProductModel;
			array[8] = new SqlParameter("@ProductStandard", DbType.String);
			array[8].Value = ProductStandard;
			array[9] = new SqlParameter("@ProducerName", DbType.String);
			array[9].Value = ProducerName;
			array[10] = new SqlParameter("@TrademarkName", DbType.String);
			array[10].Value = TrademarkName;
			array[11] = new SqlParameter("@ProductIntro", DbType.String);
			array[11].Value = ProductIntro;
			array[12] = new SqlParameter("@ProductImageUrl", DbType.String);
			array[12].Value = ProductImageUrl;
			array[13] = new SqlParameter("@ProductType", DbType.Int32);
			array[13].Value = ProductType;
			array[14] = new SqlParameter("@StandPrice", DbType.Decimal);
			array[14].Value = StandPrice;
			array[15] = new SqlParameter("@AuctionStartPrice", DbType.Decimal);
			array[15].Value = AuctionStartPrice;
			array[16] = new SqlParameter("@ImcrementPrice", DbType.Decimal);
			array[16].Value = ImcrementPrice;
			array[17] = new SqlParameter("@MemberPrice", DbType.Decimal);
			array[17].Value = MemberPrice;
			array[18] = new SqlParameter("@TeamName", DbType.String);
			array[18].Value = TeamName;
			array[19] = new SqlParameter("@TeamNum", DbType.String);
			array[19].Value = TeamNum;
			array[20] = new SqlParameter("@TeamPrice1", DbType.Decimal);
			array[20].Value = TeamPrice1;
			array[21] = new SqlParameter("@TempSubScriptionRate", DbType.Int32);
			array[21].Value = TempSubScriptionRate;
			array[22] = new SqlParameter("@TeamNumber1", DbType.Int32);
			array[22].Value = TeamNumber1;
			array[23] = new SqlParameter("@TeamPrice2", DbType.Decimal);
			array[23].Value = TeamPrice2;
			array[24] = new SqlParameter("@TeamNumber2", DbType.Int32);
			array[24].Value = TeamNumber2;
			array[25] = new SqlParameter("@TeamPrice3", DbType.Decimal);
			array[25].Value = TeamPrice3;
			array[26] = new SqlParameter("@TeamNumber3", DbType.Int32);
			array[26].Value = TeamNumber3;
			array[27] = new SqlParameter("@TeamPrice4", DbType.Decimal);
			array[27].Value = TeamPrice4;
			array[28] = new SqlParameter("@TeamNumber4", DbType.Int32);
			array[28].Value = TeamNumber4;
			array[29] = new SqlParameter("@TeamPrice5", DbType.Decimal);
			array[29].Value = TeamPrice5;
			array[30] = new SqlParameter("@TeamNumber5", DbType.Int32);
			array[30].Value = TeamNumber5;
			array[31] = new SqlParameter("@IsElite", DbType.Boolean);
			array[31].Value = IsElite;
			array[32] = new SqlParameter("@Stocks", DbType.Int32);
			array[32].Value = Stocks;
			array[33] = new SqlParameter("@EnableSale", DbType.Boolean);
			array[33].Value = EnableSale;
			array[34] = new SqlParameter("@Keyword", DbType.String);
			array[34].Value = Keyword;
			array[35] = new SqlParameter("@Inputer", DbType.String);
			array[35].Value = Inputer;
			array[36] = new SqlParameter("@SalePromotionType", DbType.Int32);
			array[36].Value = SalePromotionType;
			array[37] = new SqlParameter("@Weight", DbType.Int32);
			array[37].Value = Weight;
			array[38] = new SqlParameter("@Propority", DbType.String);
			array[38].Value = Propority;
			array[39] = new SqlParameter("@DeliverType", DbType.String);
			array[39].Value = DeliverType;
			array[40] = new SqlParameter("@DeliverCharge", DbType.String);
			array[40].Value = DeliverCharge;
			array[41] = new SqlParameter("@NeedInvoice", DbType.Boolean);
			array[41].Value = NeedInvoice;
			array[42] = new SqlParameter("@Guarantee", DbType.Boolean);
			array[42].Value = Guarantee;
			array[43] = new SqlParameter("@ValidDay", DbType.Int32);
			array[43].Value = ValidDay;
			array[44] = new SqlParameter("@AutoPostBack", DbType.Boolean);
			array[44].Value = AutoPostBack;
			array[45] = new SqlParameter("@Remark", DbType.String);
			array[45].Value = Remark;
			array[46] = new SqlParameter("@DeliverPayType", DbType.Int32);
			array[46].Value = DeliverPayType;
			array[47] = new SqlParameter("@OnlinePayType", DbType.String);
			array[47].Value = OnlinePayType;
			array[48] = new SqlParameter("@PayType", DbType.String);
			array[48].Value = PayType;
			array[49] = new SqlParameter("@Hits", DbType.Int32);
			array[49].Value = Hits;
			array[50] = new SqlParameter("@BuyTimes", DbType.Int32);
			array[50].Value = BuyTimes;
			array[51] = new SqlParameter("@OnTop", DbType.Boolean);
			array[51].Value = OnTop;
			array[52] = new SqlParameter("@IsHot", DbType.Boolean);
			array[52].Value = IsHot;
			array[53] = new SqlParameter("@Stars", DbType.Int32);
			array[53].Value = Stars;
			array[54] = new SqlParameter("@BeginDate", DbType.DateTime);
			array[54].Value = BeginDate;
			array[55] = new SqlParameter("@EndDate", DbType.DateTime);
			array[55].Value = EndDate;
			array[56] = new SqlParameter("@LimitNum", DbType.Int32);
			array[56].Value = LimitNum;
			array[57] = new SqlParameter("@EnableSingleSell", DbType.Boolean);
			array[57].Value = EnableSingleSell;
			array[58] = new SqlParameter("@TemplateID", DbType.Int32);
			array[58].Value = TemplateID;
			array[59] = new SqlParameter("@SkinID", DbType.Int32);
			array[59].Value = SkinID;
			array[60] = new SqlParameter("@Discount", DbType.Int32);
			array[60].Value = Discount;
			array[61] = new SqlParameter("@PresentExp", DbType.Int32);
			array[61].Value = PresentExp;
			array[62] = new SqlParameter("@PresentPoint", DbType.Int32);
			array[62].Value = PresentPoint;
			array[63] = new SqlParameter("@PresentMoney", DbType.Decimal);
			array[63].Value = PresentMoney;
			array[64] = new SqlParameter("@Discount1", DbType.Int32);
			array[64].Value = Discount1;
			array[65] = new SqlParameter("@PresentExp1", DbType.Int32);
			array[65].Value = PresentExp1;
			array[66] = new SqlParameter("@PresentPoint1", DbType.Int32);
			array[66].Value = PresentPoint1;
			array[67] = new SqlParameter("@PresentMoney1", DbType.Decimal);
			array[67].Value = PresentMoney1;
			array[68] = new SqlParameter("@Discount2", DbType.Int32);
			array[68].Value = Discount2;
			array[69] = new SqlParameter("@PresentExp2", DbType.Int32);
			array[69].Value = PresentExp2;
			array[70] = new SqlParameter("@PresentPoint2", DbType.Int32);
			array[70].Value = PresentPoint2;
			array[71] = new SqlParameter("@PresentMoney2", DbType.Decimal);
			array[71].Value = PresentMoney2;
			array[72] = new SqlParameter("@Discount3", DbType.Int32);
			array[72].Value = Discount3;
			array[73] = new SqlParameter("@PresentExp3", DbType.Int32);
			array[73].Value = PresentExp3;
			array[74] = new SqlParameter("@PresentPoint3", DbType.Int32);
			array[74].Value = PresentPoint3;
			array[75] = new SqlParameter("@PresentMoney3", DbType.Decimal);
			array[75].Value = PresentMoney3;
			array[76] = new SqlParameter("@PUnit", DbType.String);
			array[76].Value = PUnit;
			array[77] = new SqlParameter("@ProductSmallImageUrl", DbType.String);
			array[77].Value = ProductSmallImageUrl;
			array[78] = new SqlParameter("@TaxRate", DbType.Int32);
			array[78].Value = TaxRate;
			array[79] = new SqlParameter("@CurrentPrice", DbType.Decimal);
			array[79].Value = CurrentPrice;
			array[80] = new SqlParameter("@UploadFiles", DbType.String);
			array[80].Value = UploadFiles;
			array[81] = new SqlParameter("@Province", DbType.String);
			array[81].Value = Province;
			array[82] = new SqlParameter("@City", DbType.String);
			array[82].Value = City;
			array[83] = new SqlParameter("@Color", DbType.String);
			array[83].Value = Color;
			array[84] = new SqlParameter("@Size", DbType.String);
			array[84].Value = Size;
			array[85] = new SqlParameter("@Attributes", DbType.String);
			array[85].Value = Attributes;
			array[86] = new SqlParameter("@PartPrice", DbType.Decimal);
			array[86].Value = PartPrice;
			array[87] = new SqlParameter("@ColorAttribute", DbType.String);
			array[87].Value = StrColor;
			array[88] = new SqlParameter("@SizeAttribute", DbType.String);
			array[88].Value = StrSize;
			array[89] = new SqlParameter("@CustomPrice", DbType.String);
			array[89].Value = CustomPrice;
			array[90] = new SqlParameter("@IntegraUse", DbType.Boolean);
			array[90].Value = IntegraUse;
			return this.conn.GetDataTable("PR_AddProduct", array);
		}
		public DataTable GetProductByCategoryIDShopIDKeywords(int CateGoryID, int ShopID, string KeyWords, string DateTimeSect)
		{
			DataTable result;
			if (KeyWords != "" || KeyWords != null || DateTimeSect != "")
			{
				if (DateTimeSect == null)
				{
					DateTimeSect = "";
				}
				if (KeyWords == null)
				{
					KeyWords = "";
				}
				if (CateGoryID == 0)
				{
					CateGoryID = -1;
				}
				DataTable productByCategoryIDShopIDKeywords = Shop_Product.Adapter.GetProductByCategoryIDShopIDKeywords(new int?(CateGoryID), new int?(ShopID), KeyWords, DateTimeSect);
				int[] array = new int[productByCategoryIDShopIDKeywords.Rows.Count];
				for (int i = 0; i < array.Length; i++)
				{
					array[i] = -1;
				}
				int num = 0;
				int num2 = 0;
				foreach (DataRow dataRow in productByCategoryIDShopIDKeywords.Rows)
				{
					if (dataRow["EnableSale"].ToString().Trim() != "1" || dataRow["EnableSingleSell"].ToString().Trim() != "1")
					{
						array[num2++] = num;
					}
					num++;
				}
				for (int j = array.Length - 1; j >= 0; j--)
				{
					if (array[j] >= 0)
					{
						productByCategoryIDShopIDKeywords.Rows.RemoveAt(array[j]);
					}
				}
				result = productByCategoryIDShopIDKeywords;
			}
			else
			{
				result = null;
			}
			return result;
		}
		public void SetProductElite(bool IsElite, int ProductID)
		{
			Shop_Product.Adapter.SetProductElite(new bool?(IsElite), ProductID);
		}
		public bool IsMaxElite(int SalerID, int Num)
		{
			DataTable recommendProductBySalerID = Shop_Product.Adapter.GetRecommendProductBySalerID(new int?(SalerID));
			return recommendProductBySalerID.Rows.Count > Num;
		}
		public void UpdateProductClass(int ShopProductClassID, int ProductID)
		{
			Shop_Product.Adapter.UpdateProductClass(new int?(ShopProductClassID), ProductID);
		}
		public DataTable GetShopUploadProductFile(string NickName, string UploadFilename, int U_Identify)
		{
			return Shop_Product.Adapter.GetShopUploadProductFile(NickName, UploadFilename, new int?(U_Identify));
		}
		public DataTable GetProductByShopCategoryIDKeyWord(int ShopID, int ShopProductClassID, string KeyWord)
		{
			return Shop_Product.Adapter.GetProductByShopCategoryID(new int?(ShopID), new int?(ShopProductClassID), KeyWord);
		}
		public DataTable GetProductByShopProductClassID(int ShopID, int ShopProductClassID, string KeyWord)
		{
			string text = "";
			if (KeyWord != "" || KeyWord != null)
			{
				text = " and ProductName like '%" + KeyWord + "%' ";
			}
			string text2 = " Select ProductID,ProductName,ProductImageUrl,ProductSmallImageUrl,Stocks,Hits,BidTimes, case when ProductType =1 then StandPrice ";
			text2 += " when (ProductType=3 and TeamNum=1)  then TeamPrice1 when(ProductType=3 and TeamNum=2) then TeamPrice2 when(ProductType=3 and TeamNum=3) then TeamPrice3 when(ProductType=3 and TeamNum=4) then TeamPrice4 when(ProductType=3 and TeamNum=5) then TeamPrice5 when ProductType =4 then StandPrice when ProductType =5 then StandPrice else AuctionStartPrice end as StandPrice, DATEDIFF(s,BeginDate,EndDate) as LeftTime,ProductType, CurrentPrice,BeginDate,ClassID ";
			object obj = text2;
			text2 = string.Concat(new object[]
			{
				obj,
				" From HLShop_Product where ShopProductCategoryID = ",
				ShopProductClassID,
				"  and EnableSale=1 and Stocks>0 and DateDiff(s,EndDate,getdate())<=0 and HLShop_Product.ShopID=",
				ShopID,
				text,
				" Order By BeginDate Desc"
			});
			return this.conn.GetDataTable(text2);
		}
		public DataTable GetProductByShopProductClassID(int ShopID, string m_where)
		{
			string text = " Select ProductID,ProductName,ProductImageUrl,ProductSmallImageUrl,Stocks,Hits,BidTimes, case when ProductType =1 then StandPrice ";
			text += " when (ProductType=3 and TeamNum=1)  then TeamPrice1 when(ProductType=3 and TeamNum=2) then TeamPrice2 when(ProductType=3 and TeamNum=3) then TeamPrice3 when(ProductType=3 and TeamNum=4) then TeamPrice4 when(ProductType=3 and TeamNum=5) then TeamPrice5 when ProductType =4 then StandPrice when ProductType =5 then StandPrice else AuctionStartPrice end as StandPrice, DATEDIFF(s,BeginDate,EndDate) as LeftTime,ProductType, CurrentPrice,BeginDate,ClassID ";
			object obj = text;
			text = string.Concat(new object[]
			{
				obj,
				" From HLShop_Product where EnableSale=1 and Stocks>0 and DateDiff(s,EndDate,getdate())<=0 and HLShop_Product.ShopID=",
				ShopID,
				m_where,
				" Order By BeginDate Desc"
			});
			return this.conn.GetDataTable(text);
		}
		public void MoveShopProductCategory(int ShopCateGoryID)
		{
			Shop_Product.Adapter.MoveShopProductCategory(new int?(ShopCateGoryID));
		}
		public bool UpdateSaleProduct(int ProductID, string ProductType, int BuyerID, decimal AuctionCurrentPrice, int Quantity)
		{
			S_Product.HLShop_ProductDataTable productByProductID = Shop_Product.Adapter.GetProductByProductID(ProductID);
			bool result;
			if (productByProductID.Rows.Count == 0)
			{
				result = false;
			}
			else
			{
				S_Product.HLShop_ProductRow hLShop_ProductRow = productByProductID[0];
				hLShop_ProductRow.BuyTimes++;
				if (ProductType == "2")
				{
					hLShop_ProductRow.CurrentPrice = AuctionCurrentPrice;
					hLShop_ProductRow.BidTimes++;
					if (BuyerID != 0)
					{
						hLShop_ProductRow.CurrentBidderID = BuyerID;
					}
				}
				else
				{
					if (ProductType == "1")
					{
						hLShop_ProductRow.Stocks -= Quantity;
						hLShop_ProductRow.OrderNum += Quantity;
					}
				}
				int num = 1;
				result = (num == 1);
			}
			return result;
		}
		public DataTable GetAuctionCurrentPriceByProductID(int ProductID)
		{
			return Shop_Product.Adapter.GetAuctionCurrentPrice(ProductID);
		}
		public bool DeleteProductImg(int ProductID)
		{
			S_Product.HLShop_ProductDataTable productByProductID = Shop_Product.Adapter.GetProductByProductID(ProductID);
			bool result;
			if (productByProductID.Rows.Count < 1)
			{
				result = false;
			}
			else
			{
				S_Product.HLShop_ProductRow hLShop_ProductRow = productByProductID[0];
				hLShop_ProductRow.ProductImageUrl = "";
				result = true;
			}
			return result;
		}
		public bool UpdateProduct(int ProductID, string ProductPlace, int? ClassID, string ProductName, string ProductStandard, string ProductIntro, string ProductImageUrl, string ProductType, decimal? StandPrice, decimal? AuctionStartPrice, decimal? ImcrementPrice, decimal? MemberPrice, string TeamName, int? TeamNum, decimal? TeamPrice1, decimal? TempSubScriptionRate, int? TeamNumber1, decimal? TeamPrice2, int? TeamNumber2, decimal? TeamPrice3, int? TeamNumber3, decimal? TeamPrice4, int? TeamNumber4, decimal? TeamPrice5, int? TeamNumber5, bool? IsElite, int? Stocks, bool? EnableSale, string DeliverType, string DeliverCharge, bool? NeedInvoice, bool? Guarantee, int? ValidDay, bool? AutoPostBack, string Remark, int? DeliverPayType, string OnlinePayType, string PayType, int? TemplateID, int? SkinID, int? Discount, int? PresentExp, int? PresentPoint, decimal? PresentMoney, int? Discount1, int? PresentExp1, int? PresentPoint1, decimal? PresentMoney1, int? Discount2, int? PresentExp2, int? PresentPoint2, decimal? PresentMoney2, int? Discount3, int? PresentExp3, int? PresentPoint3, decimal? PresentMoney3, string PUnit, string SetBeginDate, string ProductSmallImageUrl, decimal? TaxRate, bool? EnableSingleSell, string UploadFiles, string ProductModel, string Keyword, DateTime? BeginDate, DateTime? EndDate, string Province, string City, string NUMTEM, string NUMCSS, string NUMTURN, string NUMBUY, string NUMCLICK, string NUMCOM, string NUMORDER, string SHOPID, string SELLID, string Color, string Size, string Attributes, string CustomPrice, bool IntegraUse)
		{
			S_Product.HLShop_ProductDataTable productByProductID = Shop_Product.Adapter.GetProductByProductID(ProductID);
			bool result;
			if (productByProductID.Rows.Count < 1)
			{
				result = false;
			}
			else
			{
				S_Product.HLShop_ProductRow hLShop_ProductRow = productByProductID[0];
				if (!string.IsNullOrEmpty(SELLID))
				{
					hLShop_ProductRow.SalerID = int.Parse(SELLID);
				}
				if (!string.IsNullOrEmpty(SHOPID))
				{
					hLShop_ProductRow.ShopID = int.Parse(SHOPID);
				}
				if (!string.IsNullOrEmpty(NUMORDER))
				{
					hLShop_ProductRow.OrderNum = int.Parse(NUMORDER);
				}
				if (!string.IsNullOrEmpty(NUMCOM))
				{
					hLShop_ProductRow.CommentCount = int.Parse(NUMCOM);
				}
				if (!string.IsNullOrEmpty(NUMCLICK))
				{
					hLShop_ProductRow.Hits = int.Parse(NUMCLICK);
				}
				if (!string.IsNullOrEmpty(NUMBUY))
				{
					hLShop_ProductRow.BuyTimes = int.Parse(NUMBUY);
				}
				if (!string.IsNullOrEmpty(NUMTURN))
				{
					hLShop_ProductRow.OrderBy = int.Parse(NUMTURN);
				}
				if (!string.IsNullOrEmpty(NUMTEM))
				{
					hLShop_ProductRow.TemplateID = int.Parse(NUMTEM);
				}
				if (!string.IsNullOrEmpty(NUMCSS))
				{
					hLShop_ProductRow.SkinID = int.Parse(NUMCSS);
				}
				if (!string.IsNullOrEmpty(Province))
				{
					hLShop_ProductRow.Province = Province;
				}
				if (!string.IsNullOrEmpty(City))
				{
					hLShop_ProductRow.City = City;
				}
				if (!string.IsNullOrEmpty(Keyword))
				{
					hLShop_ProductRow.Keyword = Keyword;
				}
				if (BeginDate.HasValue)
				{
					hLShop_ProductRow.BeginDate = BeginDate.Value;
				}
				if (EndDate.HasValue)
				{
					hLShop_ProductRow.EndDate = EndDate.Value;
				}
				if (!string.IsNullOrEmpty(ProductPlace))
				{
					hLShop_ProductRow.ProductPlace = ProductPlace;
				}
				if (ClassID.HasValue)
				{
					hLShop_ProductRow.ClassID = ClassID.Value;
				}
				if (ProductName != null)
				{
					hLShop_ProductRow.ProductName = Text.HTMLEncode(ProductName);
				}
				if (ProductIntro != null)
				{
					hLShop_ProductRow.ProductIntro = Text.wipeScript(ProductIntro);
				}
				if (Remark != null)
				{
					hLShop_ProductRow.Remark = Text.HTMLEncode(Remark);
				}
				if (ProductStandard != null)
				{
					hLShop_ProductRow.ProductStandard = ProductStandard;
				}
				if (ProductImageUrl != null)
				{
					hLShop_ProductRow.ProductImageUrl = ProductImageUrl;
				}
				if (ProductType != null)
				{
					hLShop_ProductRow.ProductType = int.Parse(ProductType);
				}
				if (StandPrice.HasValue)
				{
					hLShop_ProductRow.StandPrice = StandPrice.Value;
				}
				if (AuctionStartPrice.HasValue)
				{
					hLShop_ProductRow.AuctionStartPrice = AuctionStartPrice.Value;
				}
				if (AuctionStartPrice.HasValue)
				{
					if (hLShop_ProductRow.CurrentPrice <= 0m || hLShop_ProductRow.CurrentPrice < AuctionStartPrice)
					{
						hLShop_ProductRow.CurrentPrice = AuctionStartPrice.Value;
					}
				}
				if (ImcrementPrice.HasValue)
				{
					hLShop_ProductRow.ImcrementPrice = ImcrementPrice.Value;
				}
				if (MemberPrice.HasValue)
				{
					hLShop_ProductRow.MemberPrice = MemberPrice.Value;
				}
				if (TeamNum.HasValue)
				{
					hLShop_ProductRow.TeamNum = TeamNum.Value;
				}
				if (TeamPrice1.HasValue)
				{
					hLShop_ProductRow.TeamPrice1 = TeamPrice1.Value;
				}
				if (TempSubScriptionRate.HasValue)
				{
					hLShop_ProductRow.TempSubScriptionRate = TempSubScriptionRate.Value;
				}
				if (TeamPrice2.HasValue)
				{
					hLShop_ProductRow.TeamPrice2 = TeamPrice2.Value;
				}
				if (TeamPrice3.HasValue)
				{
					hLShop_ProductRow.TeamPrice3 = TeamPrice3.Value;
				}
				if (TeamPrice4.HasValue)
				{
					hLShop_ProductRow.TeamPrice4 = TeamPrice4.Value;
				}
				if (TeamPrice5.HasValue)
				{
					hLShop_ProductRow.TeamPrice5 = TeamPrice5.Value;
				}
				if (TeamNumber5.HasValue)
				{
					hLShop_ProductRow.TeamNumber5 = TeamNumber5.Value;
				}
				if (TeamNumber4.HasValue)
				{
					hLShop_ProductRow.TeamNumber4 = TeamNumber4.Value;
				}
				if (TeamNumber3.HasValue)
				{
					hLShop_ProductRow.TeamNumber3 = TeamNumber3.Value;
				}
				if (TeamNumber2.HasValue)
				{
					hLShop_ProductRow.TeamNumber2 = TeamNumber2.Value;
				}
				if (TeamNumber1.HasValue)
				{
					hLShop_ProductRow.TeamNumber1 = TeamNumber1.Value;
				}
				if (IsElite.HasValue)
				{
					hLShop_ProductRow.IsElite = IsElite.Value;
				}
				if (Stocks.HasValue)
				{
					hLShop_ProductRow.Stocks = Stocks.Value;
				}
				if (EnableSale.HasValue)
				{
					hLShop_ProductRow.EnableSale = EnableSale.Value;
				}
				if (DeliverType != null)
				{
					hLShop_ProductRow.DeliverType = DeliverType;
				}
				if (DeliverCharge != null)
				{
					hLShop_ProductRow.DeliverCharge = DeliverCharge;
				}
				if (NeedInvoice.HasValue)
				{
					hLShop_ProductRow.NeedInvoice = NeedInvoice.Value;
				}
				if (Guarantee.HasValue)
				{
					hLShop_ProductRow.Guarantee = Guarantee.Value;
				}
				if (ValidDay.HasValue)
				{
					hLShop_ProductRow.ValidDay = ValidDay.Value;
				}
				if (AutoPostBack.HasValue)
				{
					hLShop_ProductRow.AutoPostBack = AutoPostBack.Value;
				}
				if (DeliverPayType.HasValue)
				{
					hLShop_ProductRow.DeliverPayType = DeliverPayType.Value;
				}
				if (OnlinePayType != null)
				{
					hLShop_ProductRow.DependentProducts = OnlinePayType;
				}
				if (PayType != null)
				{
					hLShop_ProductRow.PayType = PayType;
				}
				if (TemplateID.HasValue)
				{
					hLShop_ProductRow.TemplateID = TemplateID.Value;
				}
				if (SkinID.HasValue)
				{
					hLShop_ProductRow.SkinID = SkinID.Value;
				}
				if (Discount.HasValue)
				{
					hLShop_ProductRow.Discount = Discount.Value;
				}
				if (PresentExp.HasValue)
				{
					hLShop_ProductRow.PresentExp = PresentExp.Value;
				}
				if (PresentPoint.HasValue)
				{
					hLShop_ProductRow.PresentPoint = PresentPoint.Value;
				}
				if (PresentMoney.HasValue)
				{
					hLShop_ProductRow.PresentMoney = PresentMoney.Value;
				}
				if (Discount1.HasValue)
				{
					hLShop_ProductRow.Discount1 = Discount1.Value;
				}
				if (PresentExp1.HasValue)
				{
					hLShop_ProductRow.PresentExp1 = PresentExp1.Value;
				}
				if (PresentPoint1.HasValue)
				{
					hLShop_ProductRow.PresentPoint1 = PresentPoint1.Value;
				}
				if (PresentMoney1.HasValue)
				{
					hLShop_ProductRow.PresentMoney1 = PresentMoney1.Value;
				}
				if (Discount2.HasValue)
				{
					hLShop_ProductRow.Discount2 = Discount2.Value;
				}
				if (PresentExp2.HasValue)
				{
					hLShop_ProductRow.PresentExp2 = PresentExp2.Value;
				}
				if (PresentPoint2.HasValue)
				{
					hLShop_ProductRow.PresentPoint2 = PresentPoint2.Value;
				}
				if (PresentMoney2.HasValue)
				{
					hLShop_ProductRow.PresentMoney2 = PresentMoney2.Value;
				}
				if (Discount3.HasValue)
				{
					hLShop_ProductRow.Discount3 = Discount3.Value;
				}
				if (PresentExp3.HasValue)
				{
					hLShop_ProductRow.PresentExp3 = PresentExp3.Value;
				}
				if (PresentPoint3.HasValue)
				{
					hLShop_ProductRow.PresentPoint3 = PresentPoint3.Value;
				}
				if (PresentMoney3.HasValue)
				{
					hLShop_ProductRow.PresentMoney3 = PresentMoney3.Value;
				}
				if (PUnit != null)
				{
					hLShop_ProductRow.PUnit = PUnit;
				}
				if (UploadFiles != null)
				{
					hLShop_ProductRow.UploadFiles = UploadFiles;
				}
				if (!string.IsNullOrEmpty(ProductModel))
				{
					hLShop_ProductRow.ProductModel = ProductModel;
				}
				if (!string.IsNullOrEmpty(ProductSmallImageUrl))
				{
					hLShop_ProductRow.ProductSmallImageUrl = ProductSmallImageUrl;
				}
				hLShop_ProductRow.Color = Color;
				hLShop_ProductRow.Size = Size;
				if (Attributes != null)
				{
					hLShop_ProductRow.Attributes = Attributes;
				}
				if (CustomPrice != null)
				{
					hLShop_ProductRow.CustomPrice = CustomPrice;
				}
				hLShop_ProductRow.IntegraUse = IntegraUse;
				hLShop_ProductRow.UpdateTime = DateTime.Now;
				if (TaxRate.HasValue)
				{
					hLShop_ProductRow.TaxRate = TaxRate.Value;
				}
				int num = Shop_Product.Adapter.Update(hLShop_ProductRow);
				result = (num == 1);
			}
			return result;
		}
		public DataTable GetProductIsOnTopOrHot(string Type)
		{
			return Shop_Product.Adapter.GetProductIsOntoporHot(Type);
		}
		public DataTable AdminProduct(string SearchType, string QuickSearchName, string DetailSearchType, string DetailSearchName, int PageSize, int PageIndex, bool OrderType, string fldName, int SearchCount)
		{
			string tblName = "HLShop_Product";
			string strGetFields = "ProductName,ProductID,ProductType,Stocks,BidTimes,Hits,SalerID,EnableSingleSell,EnableSale,OnTop,IsElite,IsHot,ProductImageUrl,(select ClassName from HLShop_Class Where HLShop_Product.ClassID=HLShop_Class.ClassID)As ClassName,ClassID";
			int num = PageSize;
			if (num < 5)
			{
				num = 5;
			}
			int value;
			if (PageIndex > 0)
			{
				value = PageIndex;
			}
			else
			{
				value = 1;
			}
			string text = " 1=1 ";
			int value2;
			if (!OrderType)
			{
				value2 = 0;
			}
			else
			{
				value2 = 1;
			}
			if (SearchType == "QuickSearch")
			{
				if (QuickSearchName != null)
				{
					if (!(QuickSearchName == "all_product"))
					{
						if (!(QuickSearchName == "on_sale"))
						{
							if (!(QuickSearchName == "on_stock"))
							{
								if (!(QuickSearchName == "on_top"))
								{
									if (!(QuickSearchName == "saler_recommend"))
									{
										if (QuickSearchName == "stop_sale")
										{
											text += " and EnableSingleSell=0";
										}
									}
									else
									{
										text += " and IsElite=1";
									}
								}
								else
								{
									text += " and OnTop=1";
								}
							}
							else
							{
								text += " and EnableSale=0";
							}
						}
						else
						{
							text += " and EnableSale=1";
						}
					}
					else
					{
						text = (text ?? "");
					}
				}
			}
			else
			{
				if (SearchType == "DetailSearch")
				{
					if (DetailSearchName != "")
					{
						if (DetailSearchType != null)
						{
							if (!(DetailSearchType == "product_name"))
							{
								if (!(DetailSearchType == "saler_name"))
								{
									if (!(DetailSearchType == "product_class"))
									{
										if (DetailSearchType == "product_place")
										{
											text = text + "  and ProductPlace like '%" + DetailSearchName + "%'";
										}
									}
									else
									{
										Shop_Class shop_Class = new Shop_Class();
										DataTable classByClassName = shop_Class.GetClassByClassName(DetailSearchName);
										string text2 = "";
										for (int i = 0; i < classByClassName.Rows.Count; i++)
										{
											text2 = text2 + classByClassName.Rows[i]["ClassID"].ToString() + ",";
										}
										if (classByClassName.Rows.Count > 0)
										{
											text2 = text2.Remove(text2.Length - 1);
										}
										else
										{
											text2 = "-1";
										}
										text = text + " and classid in (" + text2 + ")";
										classByClassName.Dispose();
									}
								}
								else
								{
									UserBll userBll = new UserBll();
									DataTable userLikeUserName = userBll.GetUserLikeUserName(DetailSearchName, 1, 500);
									string text3 = "";
									for (int j = 0; j < userLikeUserName.Rows.Count; j++)
									{
										text3 = text3 + userLikeUserName.Rows[0]["UserID"].ToString() + ",";
									}
									if (text3.Length > 1)
									{
										text3 = text3.Remove(text3.Length - 1);
									}
									else
									{
										text3 = "-1";
									}
									text = text + " and salerID in(" + text3 + ")";
								}
							}
							else
							{
								text = text + " and ProductName like '%" + DetailSearchName + "%'";
							}
						}
					}
				}
			}
			return Shop_Product.Adapter.GetProductPerPage(tblName, strGetFields, fldName, new int?(num), new int?(value), new int?(value2), text, new int?(SearchCount));
		}
		public DataTable GetPageCount(string SearchType, string QuickSearchName, string DetailSearchType, string DetailSearchName)
		{
			string tblName = "HLShop_Product";
			string strGetFields = "ProductName,ProductID,ProductType,Stocks,BidTimes,Hits,SalerID";
			string fldName = "ProductID";
			int value = 5;
			int value2 = 1;
			string strWhere = "";
			if (SearchType == "QuickSearch")
			{
				if (QuickSearchName != null)
				{
					if (!(QuickSearchName == "all_product"))
					{
						if (!(QuickSearchName == "on_sale"))
						{
							if (!(QuickSearchName == "on_stock"))
							{
								if (!(QuickSearchName == "on_top"))
								{
									if (!(QuickSearchName == "saler_recommend"))
									{
										if (QuickSearchName == "stop_sale")
										{
											strWhere = "EnableSingleSell=0";
										}
									}
									else
									{
										strWhere = "IsElite=1";
									}
								}
								else
								{
									strWhere = "OnTop=1";
								}
							}
							else
							{
								strWhere = "EnableSale=0";
							}
						}
						else
						{
							strWhere = "EnableSale=1";
						}
					}
					else
					{
						strWhere = "";
					}
				}
			}
			return Shop_Product.Adapter.GetProductPerPage(tblName, strGetFields, fldName, new int?(value), new int?(value2), new int?(0), strWhere, new int?(1));
		}
		public DataTable GetAdminProudctClassSum()
		{
			return Shop_Product.Adapter.GetAdminProductClassSum();
		}
		public DataTable SearchProductList(int PageSize, int PageIndex, int Count, string SearchType, string SearchText, string SearchClassID, int SortType, string ProductPlace, string StandPrice, string Auction, string TeamBuy, string PromoteBuy, string IsNew, string SecondHand, string StartPrice, string EndPrice, string OtherType)
		{
			return this.SearchProductList(PageSize, PageIndex, Count, SearchType, SearchText, SearchClassID, SortType, ProductPlace, StandPrice, Auction, TeamBuy, PromoteBuy, IsNew, SecondHand, StartPrice, EndPrice, OtherType, "");
		}
		public DataTable SearchProductList(int PageSize, int PageIndex, int Count, string SearchType, string SearchText, string SearchClassID, int SortType, string ProductPlace, string StandPrice, string Auction, string TeamBuy, string PromoteBuy, string IsNew, string SecondHand, string StartPrice, string EndPrice, string OtherType, string ProductIDArray)
		{
			bool flag = false;
			string text = "";
			int pageSize = 40;
			int pageIndex = 1;
			string text2 = "";
			string text3 = "";
			int num = 0;
			int num2 = -1;
			StartPrice = Text.SQLEncode(StartPrice);
			EndPrice = Text.SQLEncode(EndPrice);
			ProductPlace = Text.SQLEncode(ProductPlace);
			SearchText = Text.SQLEncode(SearchText);
			if (ProductIDArray != "" && Text.CheckNumList(ProductIDArray, ','))
			{
				text2 = " ProductID In (" + ProductIDArray + ") ";
			}
			else
			{
				if (SearchClassID != "" && Text.IsNum(SearchClassID))
				{
					num2 = Convert.ToInt32(SearchClassID);
				}
				if (num2 >= 0)
				{
					Shop_Class shop_Class = new Shop_Class();
					DataTable classByClassID = shop_Class.GetClassByClassID(num2);
					if (classByClassID != null && classByClassID.Rows.Count > 0)
					{
						text = classByClassID.Rows[0]["arrChildID"].ToString();
					}
					classByClassID.Dispose();
				}
				if (PageSize == 20 || PageSize == 40 || PageSize == 80)
				{
					pageSize = PageSize;
				}
				if (PageIndex > 0)
				{
					pageIndex = PageIndex;
				}
				else
				{
					pageIndex = 1;
				}
				if (StandPrice == "1")
				{
					text2 += " (ProductType=1 OR";
					flag = true;
				}
				if (Auction == "1")
				{
					if (flag)
					{
						text2 += " ProductType=2  OR";
					}
					else
					{
						text2 += " (ProductType=2  OR";
					}
					flag = true;
				}
				if (TeamBuy == "1")
				{
					if (flag)
					{
						text2 += " ProductType=3 OR";
					}
					else
					{
						text2 += " (ProductType=3 OR";
					}
					flag = true;
				}
				if (PromoteBuy == "1")
				{
					if (flag)
					{
						text2 += " ProductType=4 OR";
					}
					else
					{
						text2 += " (ProductType=4 OR";
					}
					flag = true;
				}
				if (flag)
				{
					text2 = text2.Remove(text2.Length - 2);
					text2 += ") AND ";
					flag = false;
				}
				if (SecondHand == "1" || OtherType == "secondhand")
				{
					text2 += " (ProductStandard='0' OR";
					flag = true;
				}
				if (IsNew == "1")
				{
					if (flag)
					{
						text2 += " ProductStandard='1' OR";
					}
					else
					{
						text2 += " (ProductStandard='1' OR";
					}
					flag = true;
				}
				if (flag)
				{
					text2 = text2.Remove(text2.Length - 2);
					text2 += ") AND";
				}
				if (StartPrice != "" && EndPrice != "" && StartPrice != null && EndPrice != null)
				{
					if (Auction != "1" && TeamBuy != "1" && StandPrice != "1")
					{
						string text4 = text2;
						text2 = string.Concat(new string[]
						{
							text4,
							" ((AuctionStartPrice >=",
							StartPrice,
							" AND AuctionStartPrice<=",
							EndPrice,
							") OR (StandPrice >=",
							StartPrice,
							" AND StandPrice <=",
							EndPrice,
							") OR (TeamPrice1 >=",
							StartPrice,
							" AND TeamPrice1 <=",
							EndPrice,
							")) AND"
						});
					}
					else
					{
						bool flag2 = false;
						text2 += " (";
						if (Auction == "1")
						{
							string text4 = text2;
							text2 = string.Concat(new string[]
							{
								text4,
								" (AuctionStartPrice >=",
								StartPrice,
								" AND AuctionStartPrice<=",
								EndPrice,
								") OR"
							});
							flag2 = true;
						}
						if (StandPrice == "1")
						{
							string text4 = text2;
							text2 = string.Concat(new string[]
							{
								text4,
								" (StandPrice >=",
								StartPrice,
								" AND StandPrice <=",
								EndPrice,
								") OR"
							});
							flag2 = true;
						}
						if (TeamBuy == "1")
						{
							string text4 = text2;
							text2 = string.Concat(new string[]
							{
								text4,
								" (TeamPrice1 >=",
								StartPrice,
								" AND TeamPrice1 <=",
								EndPrice,
								") OR"
							});
							flag2 = true;
						}
						if (PromoteBuy == "1")
						{
							string text4 = text2;
							text2 = string.Concat(new string[]
							{
								text4,
								" (StandPrice >=",
								StartPrice,
								" AND StandPrice <=",
								EndPrice,
								") OR"
							});
							flag2 = true;
						}
						if (flag2)
						{
							text2 = text2.Remove(text2.Length - 2);
							text2 += ") AND";
						}
					}
				}
				if (ProductPlace != "" && ProductPlace != null && ProductPlace != "-1")
				{
					text2 = text2 + " ProductPlace like '%" + ProductPlace + "%'";
					text2 += " AND";
				}
				if (SearchText != null && SearchText.Trim() != "")
				{
					string text5 = string.Empty;
					string text6 = string.Empty;
					string empty = string.Empty;
					if (SearchText.Contains(" "))
					{
						text2 += " (";
						string[] array = SearchText.Split(new char[]
						{
							' '
						});
						for (int i = 0; i < array.Length; i++)
						{
							if (!array[i].Contains("+") && !array[i].Contains("-"))
							{
								if (array[i] != "")
								{
									text5 = text5 + array[i] + "|";
								}
							}
							else
							{
								if (array[i].IndexOf('+') == 0)
								{
									text5 = text5 + array[i].Substring(1) + "|";
								}
								else
								{
									if (array[i].IndexOf('-') == 0)
									{
										text6 = text6 + array[i].Substring(1) + "|";
									}
								}
							}
						}
						if (text5.Contains("|"))
						{
							text5 = text5.Remove(text5.Length - 1);
							string[] array2 = text5.Split(new char[]
							{
								'|'
							});
							for (int j = 0; j < array2.Length; j++)
							{
								text2 = text2 + " ProductName like '%" + array2[j] + "%' AND";
							}
						}
						if (text6.Contains("|"))
						{
							text6 = text6.Remove(text6.Length - 1);
							string[] array3 = text6.Split(new char[]
							{
								'|'
							});
							for (int k = 0; k < array3.Length; k++)
							{
								text2 = text2 + " ProductName not like '%" + array3[k] + "%' AND";
							}
						}
						text2 = text2.Remove(text2.Length - 3);
						text2 += ")";
					}
					else
					{
						text2 = text2 + " (ProductName like '%" + SearchText.Replace("+", "").Replace("-", "") + "%')";
					}
					text2 += " AND";
				}
				if (text != "")
				{
					text2 = text2 + " ClassID in (" + text + ")";
					text2 += " AND";
				}
				if (OtherType != "")
				{
					switch (OtherType)
					{
					case "recommend":
						text2 += " (IsElite=1) AND";
						break;
					case "hot":
						text2 += " (IsHot=1) AND";
						break;
					case "common":
						text2 += " (HLShop_Product.ShopID=0 OR (Select ShopGroupID From HLShop_Shop WHERE HLShop_Shop.ShopOwnerID=HLShop_Product.SalerID)=0) And";
						break;
					case "band":
						text2 += " (Select ShopGroupID From HLShop_Shop WHERE HLShop_Shop.ShopOwnerID=HLShop_Product.SalerID)=2 And";
						break;
					case "order":
					{
						object obj = text2;
						text2 = string.Concat(new object[]
						{
							obj,
							" ProductID in(Select top ",
							PageSize,
							" ProductID From HLShop_Order Order By OrderFormID desc) And"
						});
						break;
					}
					case "video":
						text2 += " UploadFiles like '%http%' And";
						break;
					}
				}
				text2 += " (EndDate>=GetDate() AND EnableSale=1 and EnableSingleSell=1 and Stocks>=1) AND  IsApprove=1 ";
				switch (SortType)
				{
				case 1:
					text3 = "ProductPrice ";
					num = 0;
					break;
				case 2:
					text3 = "ProductPrice ";
					num = 1;
					break;
				case 3:
					text3 = "LeftTime ";
					num = 0;
					break;
				case 4:
					text3 = "LeftTime ";
					num = 1;
					break;
				case 5:
					text3 = "ProductPrice ";
					num = 0;
					break;
				case 6:
					text3 = "ProductPrice ";
					num = 1;
					break;
				case 7:
					text3 = "Hits ";
					num = 1;
					break;
				case 8:
					text3 = "Hits ";
					num = 0;
					break;
				case 9:
					text3 = "ProductID ";
					num = 0;
					break;
				case 10:
					text3 = "ProductID ";
					num = 1;
					break;
				default:
					text3 = "LeftTime ";
					num = 0;
					break;
				}
			}
			DataTable result;
			if (text2 != "")
			{
				if (num == 0)
				{
					text3 += "asc";
				}
				else
				{
					text3 += "desc";
				}
				DataTable pagedList = this.GetPagedList(pageIndex, pageSize, text2, text3);
				result = pagedList;
			}
			else
			{
				result = null;
			}
			return result;
		}
		public DataTable GetPagedList(int PageIndex, int PageSize, string strWhere, string Order)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.AppendFormat("select  top {0} StandPrice ProductPrice, * from [HLShop_Product] where ", PageSize);
			if (strWhere.Trim() != "")
			{
				stringBuilder.AppendFormat(" {0} and ", strWhere);
			}
			stringBuilder.AppendFormat(" ProductID not in (select top {0} ProductID from [HLShop_Product] ", (PageIndex - 1) * PageSize);
			if (strWhere.Trim() != "")
			{
				stringBuilder.AppendFormat(" where {0} ", strWhere);
			}
			if (Order.Trim() != "")
			{
				stringBuilder.Append(" order by  " + Order);
			}
			stringBuilder.Append(")");
			if (Order.Trim() != "")
			{
				stringBuilder.Append(" order by  " + Order);
			}
			return new Conn().GetDataTable(stringBuilder.ToString());
		}
		public int UpdateAutoPostBack(int ProductID)
		{
			DataTable productByProductID = this.GetProductByProductID(ProductID);
			int result;
			if (productByProductID.Rows.Count == 0)
			{
				result = 0;
			}
			else
			{
				DataRow dataRow = productByProductID.Rows[0];
				if (dataRow["AutoPostBack"].ToString().ToLower() == "true")
				{
					int num = Convert.ToInt32(dataRow["ValidDay"].ToString());
					DateTime dateTime = Convert.ToDateTime(dataRow["EndDate"]).AddDays((double)num);
					DateTime now = DateTime.Now;
					TimeSpan timeSpan = dateTime.Subtract(now);
					int num2 = this.conn.Execute(string.Concat(new object[]
					{
						"Update [HLShop_Product] Set AutoPostBack=0,BeginDate='",
						now.ToString(),
						"',EndDate='",
						dateTime.ToString(),
						"',Cycle=Cycle+1,CurrentPrice=StandPrice,BuyTimes=0,TeamCurrentNumber1=0,TeamCurrentNumber2=0,TeamCurrentNumber3=0,TeamCurrentNumber4=0,TeamCurrentNumber5=0 Where ProductID=",
						ProductID
					}));
					int num3 = Convert.ToInt32(timeSpan.TotalSeconds);
					if (num2 == 1 && num3 > 0)
					{
						result = num3;
					}
					else
					{
						result = 0;
					}
				}
				else
				{
					result = 0;
				}
			}
			return result;
		}
		public bool StopSaleProductBySalerID(int UserID)
		{
			int num = Shop_Product.Adapter.StopSaleProductBySalerID(new int?(UserID));
			return num > 0;
		}
		public bool UpdateStocks(int ProductID, int amount)
		{
			S_Product.HLShop_ProductDataTable productByProductID = Shop_Product.Adapter.GetProductByProductID(ProductID);
			bool result;
			if (productByProductID.Rows.Count == 0)
			{
				result = false;
			}
			else
			{
				S_Product.HLShop_ProductRow hLShop_ProductRow = productByProductID[0];
				hLShop_ProductRow.Stocks += amount;
				result = (Shop_Product.Adapter.Update(hLShop_ProductRow) >= 1);
			}
			return result;
		}
		public bool IsLimitProduct(int LimitNum)
		{
			int num = this.conn.ExecuteCount("SELECT COUNT(ProductID) FROM HLShop_Product");
			return num <= 0 || LimitNum > num;
		}
		public DataTable GetAuctionProductByProductID(int ProductID)
		{
			DataTable result;
			if (ProductID > 0)
			{
				result = Shop_Product.Adapter.GetAuctionProductByProductID(new int?(ProductID));
			}
			else
			{
				result = null;
			}
			return result;
		}
		public int CountSaleByShopID(int ShopID)
		{
			return this.conn.ExecuteCount("select count(*) From HLShop_Product Where ShopID=" + ShopID);
		}
		public int upLoadProducts(int[] productIDS, string ProductPlace, int ClassID, string ProductStandard, string ProductType, decimal StandPrice, decimal AuctionStartPrice, decimal ImcrementPrice, string TeamName, int teamNum, decimal TeamPrice1, int TeamNumber1, decimal TeamPrice2, int TeamNumber2, decimal TeamPrice3, int TeamNumber3, decimal TeamPrice4, int TeamNumber4, decimal TeamPrice5, int teamNumber5, string PUnit, DateTime BeginDate, DateTime EndDate, string Keyword, DateTime UpdateTime, int ValidDay, string PayType, string DeliverType, int DeliverPayType, string Province, string city, bool AutoPostBack, bool IsElite, decimal TempSubScriptionRate, bool NeedInvoice, bool Guarantee, decimal TaxRate)
		{
			int num = productIDS.Length;
			string text = string.Format("UPDATE HLShop_Product SET ProductPlace = '{0}',ClassID = {1},ProductStandard= '{2}', ProductType = '{3}',\r\nStandPrice = {4},AuctionStartPrice = {5}, ImcrementPrice = {6},TeamName = '{7}',TeamNum = {8},TeamPrice1 = {9},TeamNumber1 = {10},TeamPrice2 = {11},\r\nTeamNumber2 = {12},TeamPrice3 = {13}, TeamNumber3 = {14},TeamPrice4 = {15},TeamNumber4 = {16},TeamPrice5 = {17},TeamNumber5 = {18},PUnit= '{19}',\r\nBeginDate = '{20}',EndDate = '{21}', KeyWord= '{22}',UpdateTime = '{23}',ValidDay = {24},NeedInvoice = {25},PayType = '{26}',DeliverType='{27}',\r\nDeliverPayType= {28},ProVince = '{29}',City = '{30}',AutoPostBack = '{31}',IsElite = {32},Guarantee = {34},TaxRate = {35}  WHERE ProductID = {33}\r\n", new object[]
			{
				ProductPlace,
				ClassID,
				ProductStandard,
				ProductType,
				StandPrice,
				AuctionStartPrice,
				ImcrementPrice,
				TeamName,
				teamNum,
				TeamPrice1,
				TeamNumber1,
				TeamPrice2,
				TeamNumber2,
				TeamPrice3,
				TeamNumber3,
				TeamPrice4,
				TeamNumber4,
				TeamPrice5,
				teamNumber5,
				PUnit,
				BeginDate,
				EndDate,
				Keyword,
				UpdateTime,
				ValidDay,
				NeedInvoice,
				PayType,
				DeliverType,
				DeliverPayType,
				Province,
				city,
				AutoPostBack,
				IsElite,
				productIDS[0],
				Guarantee,
				TaxRate
			});
			for (int i = 1; i < num; i++)
			{
				int num2 = productIDS[i];
				text += string.Format("||ProductID={0}", num2);
			}
			return this.conn.Execute(text);
		}
		public int new_updateproducts(int[] productids, string[] updateItemsName, string[] updateItemsValue, string[] ItemsType)
		{
			int num = updateItemsName.Length;
			int num2 = 0;
			int num3 = productids.Length;
			for (int i = 0; i < num3; i++)
			{
				string text = string.Format("UPDATE HLShop_Product SET ", new object[0]);
				for (int j = 0; j < num; j++)
				{
					if (ItemsType[j] == "string")
					{
						if (updateItemsName[j] == "Province,City")
						{
							string[] array = updateItemsValue[j].Split(new char[]
							{
								','
							});
							string arg = array[0] + array[1];
							text += string.Format("Province='{0}',City='{1}',ProductPlace='{2}',", array[0], array[1], arg);
						}
						else
						{
							text += string.Format("{0}='{1}',", updateItemsName[j], updateItemsValue[j]);
						}
					}
					else
					{
						if (ItemsType[j] == "bool")
						{
							text += string.Format("{0}={1},", updateItemsName[j], updateItemsValue[j]);
						}
						else
						{
							if (ItemsType[j] == "int")
							{
								if (updateItemsName[j].IndexOf(',') > 0)
								{
									string[] array2 = updateItemsName[j].Split(new char[]
									{
										','
									});
									string[] array3 = updateItemsValue[j].Split(new char[]
									{
										','
									});
									if (array2[1] == "DeliverPayType")
									{
										text += string.Format("DeliverType='{0}',DeliverPayType='{1}',", array3[0], array3[1]);
									}
								}
								else
								{
									text += string.Format("{0}={1},", updateItemsName[j], updateItemsValue[j]);
								}
							}
							else
							{
								if (ItemsType[j] == "DateTime")
								{
									string[] array4 = updateItemsValue[j].Split(new char[]
									{
										','
									});
									if (array4.Length == 2)
									{
										if (array4[1].Split(new char[]
										{
											' '
										})[0] == "1980-1-1")
										{
											text += string.Format("Begindate='{0}',", array4[0]);
										}
										else
										{
											text += string.Format("Begindate='{0}',Enddate='{1}',", array4[0], array4[1]);
										}
									}
									else
									{
										text += string.Format("Begindate='{0}',", array4[0]);
									}
								}
								else
								{
									text += string.Format("{0}='{1}',", updateItemsName[j], updateItemsValue[j]);
								}
							}
						}
					}
				}
				int length = text.Length;
				text = text.Substring(0, text.Length - 1);
				length = text.Length;
				text += string.Format(" WHERE ProductID={0}", productids[i]);
				if (this.conn.Execute(text) > 0)
				{
					num2++;
				}
			}
			return num2;
		}
		public DataTable getProductAndshopByProductID(int productID)
		{
			string sql = string.Format("SELECT * FROM HLShop_Product,HLShop_Shop WHERE productID={0} AND HLShop_product.shopID=HLShop_Shop.shopID", productID);
			return this.conn.GetDataTable(sql);
		}
		public DataTable getProductadnshopByProductIDS(string productIDS)
		{
			DataTable dataTable = null;
			DataTable result;
			if (productIDS != string.Empty)
			{
				string[] array = productIDS.Split(new char[]
				{
					','
				});
				string text = "Select * FROM HLShop_Product left join HLShop_Shop On HLShop_Product.shopID=HLShop_Shop.shopID WHERE";
				for (int i = 0; i < array.Length; i++)
				{
					if (array[i] != "")
					{
						text += string.Format(" HLShop_Product.productID={0} or ", array[i]);
					}
				}
				text = text.Substring(0, text.Length - 3);
				dataTable = this.conn.GetDataTable(text);
				result = dataTable;
			}
			else
			{
				result = dataTable;
			}
			return result;
		}
		public DataSet GetListSalerProduct(int salerID)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(string.Concat(new object[]
			{
				"select Convert(varchar(20),a.[ProductID])+','+Convert(varchar(20),a.[StandPrice])+','+Convert(varchar(20),a.[MemberPrice])+','+a.[ProductSmallImageUrl]+','+Convert(varchar(20),a.[Stocks]) as GetStrchar,a.[ProductName]+' ￥'+Convert(varchar(20),a.StandPrice) as ProductPrice from HLShop_Product as a where a.ProductID not in(select SecondaryProductID from HL_GroupShopProduct where SalerID=",
				salerID,
				") and ProductType=1 and EndDate>'",
				DateTime.Now.ToString(),
				"' and EnableSingleSell=1 and Stocks>0 and EnableSale=1 and [SalerID]=",
				salerID
			}));
			return this.conn.GetDataSet(stringBuilder.ToString());
		}
		public int AddGroupProduct(int SID, int MainID, int secondaryID, string MainProName, string secondaryProName, decimal yikouPrice, decimal cenkaoPrice, string StrUrl, int PartCount)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(string.Concat(new object[]
			{
				"insert into HL_GroupShopProduct(SalerID,MainProductID,SecondaryProductID,MainProName,SecondaryProName,yikouPrice,Referenceprice,StrImageUrl,SecondaryCount) values(",
				SID,
				",",
				MainID,
				",",
				secondaryID,
				",'",
				MainProName,
				"','",
				secondaryProName,
				"',",
				yikouPrice,
				",",
				cenkaoPrice,
				",'",
				StrUrl,
				"',",
				PartCount,
				")"
			}));
			return this.conn.Execute(stringBuilder.ToString());
		}
		public int EditGroupProduct(int MainID, decimal yikouPrice, decimal cenkaoPrice, int PartCount)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(string.Concat(new object[]
			{
				"Update HL_GroupShopProduct set yikouPrice=",
				yikouPrice,
				",Referenceprice=",
				cenkaoPrice,
				",SecondaryCount=",
				PartCount,
				" where MainProductID=",
				MainID
			}));
			return this.conn.Execute(stringBuilder.ToString());
		}
		public bool JustOpenShop(int UserID)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append("select count(*) from HLShop_Shop where ShopOwnerID=" + UserID);
			return this.conn.ExecuteCount(stringBuilder.ToString()) > 0;
		}
		public DataSet GetEditSalerProduct(int salerID)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(string.Concat(new object[]
			{
				"select Convert(varchar(10),[ProductID])+','+Convert(varchar(20),[StandPrice])+','+case when (MemberPrice<=0) then Convert(varchar(20),StandPrice) else Convert(varchar(20),MemberPrice) end+','+[ProductSmallImageUrl]+','+Convert(varchar(30),[Stocks]) as GetStrchar,[ProductName]+' ￥'+Convert(varchar(20),StandPrice) as ProductPrice from HLShop_Product where ProductID not in(select SecondaryProductID from HL_GroupShopProduct where [SalerID]=",
				salerID,
				") and ProductType=1 and EndDate>'",
				DateTime.Now.ToString(),
				"' and EnableSingleSell=1 and Stocks>0 and EnableSale=1 and [SalerID]=",
				salerID
			}));
			return this.conn.GetDataSet(stringBuilder.ToString());
		}
		public DataSet GetEditPartProduct(int ProductId)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append("select Convert(varchar(20),[SecondaryProductID])+','+Convert(varchar(20),[yikouPrice])+','+Convert(varchar(20),[Referenceprice])+','+[StrImageUrl]+','+Convert(varchar(20),[SecondaryCount]) as PartKeys,SecondaryProName+ '￥' +Convert(varchar(20),yikouPrice) as SecondaryProName,* from HL_GroupShopProduct where MainProductID=" + ProductId);
			return this.conn.GetDataSet(stringBuilder.ToString());
		}
		public DataSet GetPartMoney(int ProductId)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append("select sum(yikouPrice) as Money from HL_GroupShopProduct where MainProductID=" + ProductId);
			return this.conn.GetDataSet(stringBuilder.ToString());
		}
		public bool ExistPart(int partID)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append("select count(*) from HL_GroupShopProduct where SecondaryProductID=" + partID);
			return this.conn.ExecuteCount(stringBuilder.ToString()) > 0;
		}
		public int UpdateGroupTable(int PartID, int JustID)
		{
			return this.conn.Execute(string.Concat(new object[]
			{
				"update HL_GroupShopProduct set JustID=",
				JustID,
				" where SecondaryProductID=",
				PartID
			}));
		}
		public bool IfJustPart(int partID)
		{
			int num = this.conn.ExecuteCount("select count(*) from HL_GroupShopProduct where JustID=0 and JustProductID<>0 and SecondaryProductID=" + partID);
			return num > 0;
		}
		public int UpdateJustProductID(int ProductID, int Value)
		{
			return this.conn.Execute(string.Concat(new object[]
			{
				"Update HL_GroupShopProduct set JustProductID=",
				Value,
				" where SecondaryProductID=",
				ProductID
			}));
		}
		public bool JustPartIsMainProduct(int ProductID)
		{
			return this.conn.ExecuteCount("select count(*) from HL_GroupShopProduct where JustProductID=0 and SecondaryProductID=" + ProductID) > 0;
		}
		public bool ExistProduct(int ProductID)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append("select count(*) from HL_GroupShopProduct where MainProductID=" + ProductID);
			return this.conn.ExecuteCount(stringBuilder.ToString()) > 0;
		}
		public bool ExistProductImg(int ProID)
		{
			string sql = "select count(*) from HLShop_ProductImg where ProductID=" + ProID;
			return this.conn.ExecuteCount(sql) > 0;
		}
		public int DeletePartProduct(int PartID, int MainID)
		{
			string sql = string.Concat(new object[]
			{
				"delete HL_GroupShopProduct where SecondaryProductID=",
				PartID,
				" and MainProductID=",
				MainID
			});
			return this.conn.Execute(sql);
		}
		public DataTable GetProduct(int ProID)
		{
			return this.conn.GetDataTable("select * from HLShop_Product where ProductID=" + ProID);
		}
		public DataTable GetPartProduct(int PartID)
		{
			return this.conn.GetDataTable("select * from HL_GroupShopProduct where SecondaryProductID=" + PartID);
		}
		public int EditMainPartProduct(int ProID, decimal partprice)
		{
			return this.conn.Execute(string.Concat(new object[]
			{
				"update HLShop_Product set PartPrice=",
				partprice,
				" where ProductID=",
				ProID
			}));
		}
		public int EditFieldProduct(int ProID, string FieldValue, string Field)
		{
			return this.conn.Execute(string.Concat(new object[]
			{
				"update HLShop_Product set ",
				Field,
				"='",
				FieldValue,
				"' where ProductID=",
				ProID
			}));
		}
		public void Redirect(string url, string target, string windowFeatures)
		{
			HttpContext current = HttpContext.Current;
			if ((string.IsNullOrEmpty(target) || target.Equals("_self", StringComparison.OrdinalIgnoreCase)) && string.IsNullOrEmpty(windowFeatures))
			{
				current.Response.Redirect(url);
			}
			else
			{
				Page page = (Page)current.Handler;
				if (page == null)
				{
					throw new InvalidOperationException("Cannot redirect to new window outside Page context.");
				}
				url = page.ResolveClientUrl(url);
				string text;
				if (!string.IsNullOrEmpty(windowFeatures))
				{
					text = "<script>window.open(\"{0}\", \"{1}\", \"{2}\");</script>";
				}
				else
				{
					text = "<script>window.open(\"{0}\", \"{1}\");</script>";
				}
				text = string.Format(text, url, target, windowFeatures);
				MessageBox.ResponseScript(page, text);
			}
		}
		public bool ExistTeamRecord(int ProductID)
		{
			return this.conn.ExecuteCount("select count(*) from HLShop_TeamRecords where ProductID=" + ProductID) > 0;
		}
		public bool ExistUserTeamRecord(int UserID, int ProductID)
		{
			return this.conn.ExecuteCount(string.Concat(new object[]
			{
				"select count(*) from HLUser_RecordTeam where UserID=",
				UserID,
				" and ProductID=",
				ProductID
			})) > 0;
		}
		public void UpdateTeameffectOrder(int BuyLeaver, int Teameffect, int ProductID)
		{
			this.conn.Execute(string.Concat(new object[]
			{
				"update HLShop_Order set Teameffect=1 where TradeType=3 and OrderFormID in(select OrderFormID from HLShop_OrderItem where ProductID=",
				ProductID,
				") and TeamBuyLeavel=",
				BuyLeaver
			}));
		}
		public void UpdateTeamProductorRecord(int ProductID, int RecordNum, string TableName, string FieldName)
		{
			this.conn.Execute(string.Concat(new object[]
			{
				"update ",
				TableName,
				" set ",
				FieldName,
				"=",
				RecordNum,
				" where ProductID=",
				ProductID
			}));
		}
		public void UpdataTeamRemembereffectOrder(int ProductID, int BuyLeaver)
		{
			this.conn.Execute(string.Concat(new object[]
			{
				"update HLShop_Order set Remembereffect=1 where TradeType=3 and TeamBuyLeavel<=",
				BuyLeaver,
				" and Cycle in (select max(Cycle) from HLShop_Order as a,HLShop_OrderItem as b where a.OrderFormID=b.OrderFormID and b.ProductID=",
				ProductID,
				")"
			}));
			this.conn.Execute(string.Concat(new object[]
			{
				"Update HLShop_Order set Cycle=Cycle+1 where TradeType=3 and TeamBuyLeavel>",
				BuyLeaver,
				" and Cycle in (select max(Cycle) from HLShop_Order as a,HLShop_OrderItem as b where a.OrderFormID=b.OrderFormID and b.ProductID=",
				ProductID,
				")"
			}));
		}
		public bool JustCycleSeparates(int ProductID, int BuyLeaver)
		{
			int num = this.conn.Execute(string.Concat(new object[]
			{
				"Update HLShop_Order set Cycle=Cycle+1 where TradeType=3 and TeamBuyLeavel>",
				BuyLeaver,
				" and Cycle in (select max(Cycle) from HLShop_Order as a,HLShop_OrderItem as b where a.OrderFormID=b.OrderFormID and b.ProductID=",
				ProductID,
				")"
			}));
			return num > 0;
		}
		public void AttimesUpdateTeamPrice(int TeamLevel, int productID, int Cycle, decimal CurrentPrice)
		{
			switch (TeamLevel)
			{
			case 2:
				this.UpdateTeamPrice(productID, Cycle, CurrentPrice);
				break;
			case 3:
				this.UpdateTeamPrice(productID, Cycle, CurrentPrice);
				this.UpdateTeamPrice(productID, Cycle, CurrentPrice);
				break;
			case 4:
				this.UpdateTeamPrice(productID, Cycle, CurrentPrice);
				this.UpdateTeamPrice(productID, Cycle, CurrentPrice);
				this.UpdateTeamPrice(productID, Cycle, CurrentPrice);
				break;
			case 5:
				this.UpdateTeamPrice(productID, Cycle, CurrentPrice);
				this.UpdateTeamPrice(productID, Cycle, CurrentPrice);
				this.UpdateTeamPrice(productID, Cycle, CurrentPrice);
				this.UpdateTeamPrice(productID, Cycle, CurrentPrice);
				break;
			}
		}
		public void UpdateTeamPrice(int productID, int Cycle, decimal CurrentPrice)
		{
			decimal d = 0m;
			DataTable dataTable = this.conn.GetDataTable("select * from HLShop_Product where ProductID=" + productID);
			if (dataTable != null && dataTable.Rows.Count > 0)
			{
				if (Convert.ToBoolean(dataTable.Rows[0]["NeedInvoice"].ToString()))
				{
					d = decimal.Parse(dataTable.Rows[0]["TaxRate"].ToString());
				}
			}
			DataTable dataTable2 = this.conn.GetDataTable(string.Concat(new object[]
			{
				"select a.OrderFormID as OrderID,* from HLShop_Order as a,HLShop_OrderItem as b where a.OrderFormID=b.OrderFormID and b.ProductID=",
				productID,
				" and a.Cycle=",
				Cycle
			}));
			if (dataTable2 != null && dataTable2.Rows.Count > 0)
			{
				for (int i = 0; i < dataTable2.Rows.Count; i++)
				{
					int num = int.Parse(dataTable2.Rows[i]["OrderID"].ToString());
					decimal num2 = d * CurrentPrice * int.Parse(dataTable2.Rows[i]["Quantity"].ToString()) / 100m;
					decimal num3 = decimal.Parse(dataTable2.Rows[i]["Deliver_TotalPrice"].ToString());
					decimal num4 = num2 + num3 + CurrentPrice * int.Parse(dataTable2.Rows[i]["Quantity"].ToString());
					decimal num5 = CurrentPrice * int.Parse(dataTable2.Rows[i]["Quantity"].ToString());
					this.conn.Execute(string.Concat(new object[]
					{
						"Update HLShop_Order set MoneyGoods=",
						num5,
						",MoneyTotal=",
						num4,
						",Deliver_TotalPrice=",
						num3,
						",Invoice_TotalPrice=",
						num2,
						",AuctionEndPrice=",
						CurrentPrice,
						" where OrderFormID=",
						num
					}));
					this.conn.Execute(string.Concat(new object[]
					{
						"Update HLShop_OrderItem set totalPrice=",
						num4,
						" ,Price=",
						CurrentPrice,
						" where OrderFormID=",
						num
					}));
				}
			}
			dataTable2.Dispose();
		}
		public bool JustAchievingMen(int ProductID)
		{
			bool result = false;
			DataTable dataTable = this.conn.GetDataTable("select top 1 Remembereffect from HLShop_Order where Cycle=(select max(Cycle) from HLShop_Order as a,HLShop_OrderItem as b where a.OrderFormID=b.OrderFormID and b.ProductID=" + ProductID + ")");
			if (dataTable != null && dataTable.Rows.Count > 0)
			{
				result = (dataTable.Rows[0]["Remembereffect"] != null && !(dataTable.Rows[0]["Remembereffect"].ToString() == "") && int.Parse(dataTable.Rows[0]["Remembereffect"].ToString()) == 1);
			}
			return result;
		}
		public string CountTeamCycleNum(int ProductID)
		{
			DataTable dataTable = this.conn.GetDataTable("select Max(Cycle) as Cycle from HLShop_Order as a,HLShop_OrderItem as b where a.OrderFormID=b.OrderFormID and b.ProductID=" + ProductID);
			string result;
			if (dataTable != null && dataTable.Rows.Count > 0)
			{
				result = dataTable.Rows[0]["Cycle"].ToString();
			}
			else
			{
				result = "0";
			}
			return result;
		}
		public void UpdateEachOrderFormID(int OrderFormID, int ProductID, decimal CurrentPrice)
		{
			decimal d = 0m;
			decimal num = 0m;
			decimal num2 = 0m;
			decimal num3 = 0m;
			DataTable dataTable = this.conn.GetDataTable("select * from HLShop_Product where ProductID=" + ProductID);
			if (dataTable != null && dataTable.Rows.Count > 0)
			{
				if (Convert.ToBoolean(dataTable.Rows[0]["NeedInvoice"].ToString()))
				{
					d = decimal.Parse(dataTable.Rows[0]["TaxRate"].ToString());
				}
			}
			dataTable.Dispose();
			DataTable dataTable2 = this.conn.GetDataTable("select * from HLShop_Order as a,HLShop_OrderItem as b where a.OrderFormID=b.OrderFormID and a.OrderFormID=" + OrderFormID);
			if (dataTable2 != null && dataTable2.Rows.Count > 0)
			{
				int value = int.Parse(dataTable2.Rows[0]["Quantity"].ToString());
				decimal d2 = decimal.Parse(dataTable2.Rows[0]["Deliver_TotalPrice"].ToString());
				num = CurrentPrice * value * d / 100m;
				num2 = CurrentPrice * value;
				num3 = num2 + num2 * d / 100m + d2;
			}
			dataTable2.Dispose();
			this.conn.Execute(string.Concat(new object[]
			{
				"Update HLShop_Order set MoneyTotal=",
				num3,
				",MoneyGoods=",
				num2,
				",Invoice_TotalPrice=",
				num,
				",AuctionEndPrice=",
				CurrentPrice,
				" where OrderFormID=",
				OrderFormID
			}));
			this.conn.Execute(string.Concat(new object[]
			{
				"Update HLShop_OrderItem set totalPrice=",
				num3,
				",Price=",
				CurrentPrice,
				" where OrderFormID=",
				OrderFormID
			}));
		}
		public string CountTypePrice(string ProductID, string ProductType)
		{
			DataSet dataSet = this.conn.GetDataSet("select * from HLShop_Product where ProductID=" + int.Parse(ProductID));
			DataRow dataRow = dataSet.Tables[0].Rows[0];
			string result = "";
			if (dataSet != null && dataSet.Tables[0].Rows.Count > 0)
			{
				if (ProductType != null)
				{
					if (!(ProductType == "1"))
					{
						if (!(ProductType == "2"))
						{
							if (!(ProductType == "3"))
							{
								if (!(ProductType == "4"))
								{
									if (ProductType == "5")
									{
										result = dataRow["Commodityprices"].ToString();
									}
								}
								else
								{
									result = dataRow["CurrentPrice"].ToString();
								}
							}
							else
							{
								if (decimal.Parse(dataRow["TeamPrice5"].ToString()) > 0m)
								{
									result = dataRow["TeamPrice5"].ToString();
								}
								else
								{
									if (decimal.Parse(dataRow["TeamPrice4"].ToString()) > 0m)
									{
										result = dataRow["TeamPrice4"].ToString();
									}
									else
									{
										if (decimal.Parse(dataRow["TeamPrice3"].ToString()) > 0m)
										{
											result = dataRow["TeamPrice3"].ToString();
										}
										else
										{
											if (decimal.Parse(dataRow["TeamPrice2"].ToString()) > 0m)
											{
												result = dataRow["TeamPrice2"].ToString();
											}
											else
											{
												result = dataRow["TeamPrice1"].ToString();
											}
										}
									}
								}
							}
						}
						else
						{
							result = dataRow["CurrentPrice"].ToString();
						}
					}
					else
					{
						result = dataRow["CurrentPrice"].ToString();
					}
				}
			}
			dataSet.Dispose();
			return result;
		}
		public int BindSaleCredietTotalCount(int UserID)
		{
			return this.conn.ExecuteCount("select count(*) from HLMall_Credit where ByValuerID=" + UserID + " and JustSBCredit=0");
		}
		public int BindSaleCrediet(int UserID)
		{
			return this.conn.ExecuteCount("select count(*) from HLMall_Credit where ByValuerID=" + UserID + " and CreditScore=1 and JustSBCredit=0");
		}
		public int BindBuyCrediet(int UserID)
		{
			return this.conn.ExecuteCount("select count(*) from HLMall_Credit where ByValuerID=" + UserID + " and CreditScore=1 and JustSBCredit=1");
		}
		public DataTable GetIndexProduct(int classid, int selectCount, bool ispromotion)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.AppendFormat("select top {0} ", selectCount);
			stringBuilder.Append(" p.ProductID,p.ProductName,p.ClassID,p.ProductImageUrl ");
			stringBuilder.Append(" ,p.ProductType,p.CurrentPrice,p.StandPrice,p.Stocks ");
			stringBuilder.Append(" from HLShop_Product p ");
			stringBuilder.Append(" where IsApprove=1 and EnableSale=1  ");
			stringBuilder.Append(" and EnableSingleSell=1 and Stocks>0 ");
			stringBuilder.AppendFormat(" and classid={0} ", classid);
			if (ispromotion)
			{
				stringBuilder.Append(" and productType=3  ");
			}
			stringBuilder.Append(" order by p.IsPageElite,p.BuyTimes desc,UpdateTime desc ");
			DataTable result = Conn.Query(stringBuilder.ToString(), new IDbDataParameter[0]).Tables[0];
			stringBuilder.Clear();
			return result;
		}
		public DataTable GetIndexProductByParentClassid(int pclassid, int selectCount, bool ispromotion)
		{
			string text = Shop_Class.instance.GetChildClassids(pclassid).Trim(new char[]
			{
				','
			});
			if (text == "")
			{
				text = "0";
			}
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.AppendFormat("select top {0} ", selectCount);
			stringBuilder.Append(" p.ProductID,p.ProductName,p.ClassID,p.ProductImageUrl ");
			stringBuilder.Append(" ,p.ProductType,p.CurrentPrice,p.StandPrice,p.Stocks ");
			stringBuilder.Append(" from HLShop_Product p ");
			stringBuilder.Append(" where IsApprove=1 and EnableSale=1  ");
			stringBuilder.Append(" and EnableSingleSell=1 and Stocks>0 ");
			stringBuilder.AppendFormat(" and classid in({0}) ", text);
			if (ispromotion)
			{
				stringBuilder.Append(" and productType=3  ");
			}
			stringBuilder.Append(" order by p.IsPageElite,p.BuyTimes desc,UpdateTime desc ");
			DataTable result = Conn.Query(stringBuilder.ToString(), new IDbDataParameter[0]).Tables[0];
			stringBuilder.Clear();
			return result;
		}
		private DataTable dtProductInfo(string productidStr)
		{
			DataTable dataTable = null;
			if (!string.IsNullOrEmpty(productidStr))
			{
				dataTable = new DataTable();
				DataColumn column = new DataColumn("ProductID", typeof(string));
				dataTable.Columns.Add(column);
				DataColumn column2 = new DataColumn("ProductType", typeof(string));
				dataTable.Columns.Add(column2);
				DataColumn column3 = new DataColumn("DeliverType", typeof(int));
				dataTable.Columns.Add(column3);
				string sql = "select * from HLShop_Product where ProductID in (" + productidStr + ")";
				DataTable dataTable2 = this.conn.GetDataTable(sql);
				string text = "";
				string text2 = "";
				for (int i = 0; i < dataTable2.Rows.Count; i++)
				{
					DataRow dataRow = dataTable2.Rows[i];
					int num = 0;
					if (dataRow["ProductType"] != DBNull.Value)
					{
						num = dataRow["ProductType"].ToString().ToInt32(new int[0]);
					}
					if (num > 0)
					{
						int num2 = 0;
						try
						{
							if (dataTable2.Rows[i]["DeliverPayType"] != DBNull.Value)
							{
								if (dataTable2.Rows[i]["DeliverPayType"].ToString().Trim() == "1")
								{
									if (dataTable2.Rows[i]["DeliverType"] != DBNull.Value)
									{
										num2 = dataTable2.Rows[i]["DeliverType"].ToString().ToInt32(new int[0]);
									}
								}
								else
								{
									num2 = 0;
								}
							}
						}
						catch
						{
							num2 = 0;
						}
						object obj = text2;
						text2 = string.Concat(new object[]
						{
							obj,
							num,
							",",
							num2,
							"|"
						});
						text = text + num + "|";
					}
				}
				Hashtable hashtable = new Hashtable();
				if (!string.IsNullOrEmpty(text2))
				{
					text2 = text2.Substring(0, text2.Length - 1);
					text = text.Substring(0, text.Length - 1);
					ArrayList arrayList = new ArrayList();
					string[] array = text.Split(new char[]
					{
						'|'
					});
					for (int j = 0; j < array.Length; j++)
					{
						string text3 = array[j].ToString();
						if (!arrayList.Contains(text3))
						{
							arrayList.Add(text3);
						}
					}
					for (int k = 0; k < arrayList.Count; k++)
					{
						string text4 = arrayList[k].ToString();
						string key = text4;
						string text5 = "";
						string[] array2 = text2.Split(new char[]
						{
							'|'
						});
						for (int l = 0; l < array2.Length; l++)
						{
							string[] array3 = array2[l].Split(new char[]
							{
								','
							});
							if (array3.Length >= 2)
							{
								if (text4 == array3[0].Trim())
								{
									text5 = text5 + array3[1] + ",";
								}
							}
						}
						if (!string.IsNullOrEmpty(text5))
						{
							text5 = text5.Substring(0, text5.Length - 1);
							hashtable.Add(key, text5);
						}
					}
				}
				ArrayList arrayList2 = new ArrayList(hashtable.Keys);
				foreach (string text6 in arrayList2)
				{
					string[] array4 = hashtable[text6].ToString().Split(new char[]
					{
						','
					});
					if (array4.Length > 0)
					{
						int[] array5 = new int[array4.Length];
						for (int m = 0; m < array4.Length; m++)
						{
							array5[m] = array4[m].ToInt32(new int[0]);
						}
						ArrayList arrayList3 = new ArrayList();
						arrayList3.Add(array5[0]);
						for (int i = 1; i < array5.Length; i++)
						{
							bool flag = true;
							for (int n = 0; n < arrayList3.Count; n++)
							{
								if (array5[i] == int.Parse(arrayList3[n].ToString()))
								{
									flag = false;
								}
							}
							if (flag)
							{
								arrayList3.Add(array5[i]);
							}
						}
						DataView defaultView = dataTable2.DefaultView;
						defaultView.RowFilter = "ProductType=" + int.Parse(text6);
						string text7 = "";
						for (int i = 0; i < arrayList3.Count; i++)
						{
							text7 = "";
							int num3 = int.Parse(arrayList3[i].ToString());
							foreach (DataRowView dataRowView in defaultView)
							{
								if (int.Parse(dataRowView["deliverType"].ToString()) == num3)
								{
									text7 = text7 + dataRowView["productID"].ToString() + ",";
								}
							}
							if (!string.IsNullOrEmpty(text7))
							{
								text7 = text7.Substring(0, text7.Length - 1);
								DataRow dataRow2 = dataTable.NewRow();
								dataRow2["ProductID"] = text7;
								dataRow2["ProductType"] = text6;
								dataRow2["DeliverType"] = num3;
								dataTable.Rows.Add(dataRow2);
							}
						}
					}
				}
			}
			return dataTable;
		}
		public DataTable GetProductInfoAgain(string productidStr)
		{
			DataTable dataTable = new DataTable();
			Shop_Product.SetNewDataColumn(dataTable);
			DataTable dataTable2 = this.dtProductInfo(productidStr);
			for (int i = 0; i < dataTable2.Rows.Count; i++)
			{
				DataRow dataRow = dataTable2.Rows[i];
				if (dataRow["ProductType"] != DBNull.Value)
				{
					int num = dataRow["ProductType"].ToInt32(new int[0]);
				}
				if (dataRow["DeliverType"] != DBNull.Value)
				{
					int num2 = dataRow["DeliverType"].ToInt32(new int[0]);
				}
				string newProductIds = "";
				if (dataRow["ProductID"] != DBNull.Value)
				{
					newProductIds = dataRow["ProductID"].ToString();
				}
				this.GetProductTableByIds(dataTable, newProductIds);
			}
			return dataTable;
		}
		public DataTable GetProductInfo(string productidStr)
		{
			DataTable dataTable = new DataTable();
			Shop_Product.SetNewDataColumn(dataTable);
			this.GetProductTableByIds(dataTable, productidStr);
			return dataTable;
		}
		private void GetProductTableByIds(DataTable newTable, string newProductIds)
		{
			if (!string.IsNullOrEmpty(newProductIds))
			{
				string sql = "select * from HLShop_Product where ProductID in (" + newProductIds + ")";
				DataTable dataTable = this.conn.GetDataTable(sql);
				for (int i = 0; i < dataTable.Rows.Count; i++)
				{
					DataRow dataRow = dataTable.Rows[i];
					int num = 0;
					if (dataRow["ProductID"] != DBNull.Value)
					{
						num = Convert.ToInt32(dataRow["ProductID"].ToString());
					}
					int num2 = 0;
					if (dataRow["ProductType"] != DBNull.Value)
					{
						num2 = Convert.ToInt32(dataRow["ProductType"].ToString());
					}
					string value = "";
					if (dataRow["ProductName"] != DBNull.Value)
					{
						value = dataRow["ProductName"].ToString();
					}
					string value2 = "";
					if (dataRow["ProductSmallImageUrl"] != DBNull.Value)
					{
						value2 = dataRow["ProductSmallImageUrl"].ToString();
					}
					int num3 = 0;
					if (dataRow["Stocks"] != DBNull.Value)
					{
						num3 = Convert.ToInt32(dataRow["Stocks"].ToString());
					}
					decimal num4 = 0m;
					if (dataRow["StandPrice"] != DBNull.Value)
					{
						num4 = dataRow["StandPrice"].ToString().ToDecimal2();
					}
					string value3 = "";
					if (dataRow["PUnit"] != DBNull.Value)
					{
						value3 = dataRow["PUnit"].ToString();
					}
					int num5 = 0;
					if (dataRow["NeedInvoice"] != DBNull.Value)
					{
						string text = dataRow["NeedInvoice"].ToString().Trim();
						if (text == "1" || text.ToLower() == "true")
						{
							num5 = 1;
						}
						else
						{
							num5 = 0;
						}
					}
					decimal num6 = 0m;
					if (dataRow["TaxRate"] != DBNull.Value)
					{
						num6 = dataRow["TaxRate"].ToString().ToDecimal2();
					}
					int num7 = 0;
					if (dataRow["PresentExp"] != DBNull.Value)
					{
						num7 = Convert.ToInt32(dataRow["PresentExp"].ToString());
					}
					decimal num8 = 0m;
					if (dataRow["PresentMoney"] != DBNull.Value)
					{
						num8 = dataRow["PresentMoney"].ToString().ToDecimal2();
					}
					int num9 = 0;
					if (dataRow["PresentPoint"] != DBNull.Value)
					{
						num9 = Convert.ToInt32(dataRow["PresentPoint"].ToString());
					}
					int num10 = 0;
					if (dataRow["Cycle"] != DBNull.Value)
					{
						num10 = Convert.ToInt32(dataRow["Cycle"].ToString());
					}
					int num11 = 0;
					string text2 = dataRow["DeliverPayType"].ToString();
					if (text2 != "0")
					{
						num11 = Convert.ToInt32(dataRow["DeliverType"]);
					}
					string text3 = "";
					string text4 = "";
					if (text2 != "0")
					{
						Shop_DeliverType shop_DeliverType = new Shop_DeliverType(this.conn);
						DataTable tableType = shop_DeliverType.GetTableType(num11);
						foreach (DataRow dataRow2 in tableType.Rows)
						{
							string text5 = "";
							decimal defaultPrice = 0m;
							decimal deincrementPrice = 0m;
							string arriveArea = "";
							if (dataRow2["TypeName"] != DBNull.Value)
							{
								string text6 = dataRow2["TypeName"].ToString();
							}
							if (dataRow2["name"] != DBNull.Value)
							{
								text5 = dataRow2["name"].ToString();
							}
							if (dataRow2["default"] != DBNull.Value)
							{
								defaultPrice = dataRow2["default"].ToString().ToDecimal2();
							}
							if (dataRow2["defIncrement"] != DBNull.Value)
							{
								deincrementPrice = dataRow2["defIncrement"].ToString().ToDecimal2();
							}
							if (dataRow2["area"] != DBNull.Value)
							{
								arriveArea = dataRow2["area"].ToString();
							}
							text4 = text4 + text5 + "|";
							text3 = text3 + shop_DeliverType.SetDeliverChargeContentDetail(num11, text5, arriveArea, defaultPrice, deincrementPrice) + "|";
						}
						if (!string.IsNullOrEmpty(text3))
						{
							text4 = text4.Substring(0, text4.Length - 1);
							text3 = text3.Substring(0, text3.Length - 1);
						}
					}
					DataRow dataRow3 = newTable.NewRow();
					dataRow3["ProductID"] = num;
					dataRow3["ProductType"] = num2;
					dataRow3["ProductName"] = value;
					dataRow3["ProductSmallImageUrl"] = value2;
					dataRow3["Stocks"] = num3;
					dataRow3["StandPrice"] = num4;
					dataRow3["PUnit"] = value3;
					dataRow3["DeliverPayType"] = text2;
					dataRow3["DeliverType"] = num11;
					dataRow3["DeliveName"] = text4;
					dataRow3["deliverCharge"] = text3;
					dataRow3["NeedInvoice"] = num5;
					dataRow3["TaxRate"] = num6;
					dataRow3["PresentExp"] = num7;
					dataRow3["PresentMoney"] = num8;
					dataRow3["PresentPoint"] = num9;
					dataRow3["Cycle"] = num10;
					newTable.Rows.Add(dataRow3);
				}
			}
		}
		private static void SetNewDataColumn(DataTable newTable)
		{
			DataColumn column = new DataColumn("ProductID", typeof(int));
			newTable.Columns.Add(column);
			DataColumn column2 = new DataColumn("ProductType", typeof(int));
			newTable.Columns.Add(column2);
			DataColumn column3 = new DataColumn("ProductName", typeof(string));
			newTable.Columns.Add(column3);
			DataColumn column4 = new DataColumn("ProductSmallImageUrl", typeof(string));
			newTable.Columns.Add(column4);
			DataColumn column5 = new DataColumn("Stocks", typeof(int));
			newTable.Columns.Add(column5);
			DataColumn column6 = new DataColumn("StandPrice", typeof(decimal));
			newTable.Columns.Add(column6);
			DataColumn column7 = new DataColumn("PUnit", typeof(string));
			newTable.Columns.Add(column7);
			DataColumn column8 = new DataColumn("DeliverPayType", typeof(int));
			newTable.Columns.Add(column8);
			DataColumn column9 = new DataColumn("DeliverType", typeof(int));
			newTable.Columns.Add(column9);
			DataColumn column10 = new DataColumn("DeliveName", typeof(string));
			newTable.Columns.Add(column10);
			DataColumn column11 = new DataColumn("deliverCharge", typeof(string));
			newTable.Columns.Add(column11);
			DataColumn column12 = new DataColumn("NeedInvoice", typeof(int));
			newTable.Columns.Add(column12);
			DataColumn column13 = new DataColumn("TaxRate", typeof(decimal));
			newTable.Columns.Add(column13);
			DataColumn column14 = new DataColumn("PresentExp", typeof(int));
			newTable.Columns.Add(column14);
			DataColumn column15 = new DataColumn("PresentMoney", typeof(decimal));
			newTable.Columns.Add(column15);
			DataColumn column16 = new DataColumn("PresentPoint", typeof(int));
			newTable.Columns.Add(column16);
			DataColumn column17 = new DataColumn("Cycle", typeof(int));
			newTable.Columns.Add(column17);
		}
		public DataTable GetMyFavouriteProductByShopID(int shopID, int topNum, string sqlwhere)
		{
			string sql = string.Concat(new object[]
			{
				"select top ",
				topNum,
				" (select COUNT(*) from [HLShop_MyFavourite] where F_Type=0 and F_ProductID=a.ProductID) as FavouriteNum,a.BuyTimes,a.ProductID,a.ProductName,a.StandPrice,a.PUnit,a.ProductImageUrl,a.ProductSmallImageUrl,a.Stocks,a.ShopID,a.SalerID,a.ProductPlace,a.ProductNum,a.ClassID from  HLShop_Product as a where  a.ShopID =",
				shopID,
				" ",
				sqlwhere,
				" order by FavouriteNum Desc"
			});
			return this.conn.GetDataTable(sql);
		}
	}
}
